nltk/nltk — Issue #73: NomLex and ComLex CorpusReader
Author: alexrudnick
Created: 2012-01-17 06:25:25+00:00
State: open

These two corpus use approximatively the same formalism
to represent entries. I made a CorpusReader that transform
these structure into elementtree, then it's easy to use them.

I attach the NomLex-Plus corpus and my script.

Migrated from http://code.google.com/p/nltk/issues/detail?id=410

earlier comments

johnstcn said, at 2010-01-26T23:47:48.000Z:

Your script is very nice! I had to figure out some way of using COMLEX without
Allegro CL for my thesis, and you did a much better job of parsing it than I did.
(Too bad that I hadn't seen your solution before I wrote my abomination...)

However, your script fails to parse the latest version of COMLEX. More specifically,
it fails to handle bracketed lists properly. Instead of turning something like :PVAL
("foo" "bar") into

"foo"

"bar"

, it tries to
create <"foo" /> and then crashes when it encounters "bar" instead of a closing
bracket.

It also potentially doesn't produce valid XML, depending on the feature / value names
used by COMLEX or NomLex. One in particular, "LOC&DIR-ADV", causes your script to
produce tages like in the XML that libraries like lxml will refuse
point blank to parse.

I modified your script to: a) be slightly more usable from the command-line, b)
properly handle lists, and c) to use attributes for things that could cause problems.
Hope other people find it useful!