nltk/nltk — Issue #72: Toolbox test in corpus.doctest is broken
Author: alexrudnick
Created: 2012-01-17 06:25:24+00:00
State: open

It looks like the key intended for use in parsing the toolbox entries is
being passed through to the chunk parser. Can you take a look at this
please Greg?

>>> river = toolbox.xml('rotokas/river.txt', key='ref')
Traceback (most recent call last):
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/nltk/corpus/reader/toolbox.py",
line 30, in xml
for (path, enc) in self.abspaths(fileids, True)])
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/nltk/toolbox/toolbox.py",
line 138, in parse
return self._chunk_parse(grammar=grammar, **kwargs)
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/nltk/toolbox/toolbox.py",
line 255, in _chunk_parse
cp = chunk.RegexpParser(grammar, top_node=top_node, trace=trace)
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/nltk/chunk/regexp.py",
line 1111, in __init__
self._parse_grammar(grammar, top_node, trace)
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/nltk/chunk/regexp.py",
line 1147, in _parse_grammar
rules.append(RegexpChunkRule.parse(line))
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/nltk/chunk/regexp.py",
line 378, in parse
raise ValueError('Illegal chunk pattern: %s' % rule)
ValueError: Illegal chunk pattern: ref

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