>>> trees = parser.nbest_parse(sent) Traceback (most recent call last): File "...\lib\site-packages\nltk\parse\chart.py", line 530, in _add_index raise ValueError('Bad restriction: %s' % key) ValueError: Bad restriction: nextWeird. The second time the next method was renamed to __next__. I suspect 2to3 at work here, as it makes no sense at all in the context. Change line #166 in parse/chart.py to:
def next(self):And line #288 to:
def next(self):And line #1047 to:
lhs = left_edge.next()):And line #1002 to:
left_edge.next() == right_edge.lhs()):And line #1118 to:
next, index = edge.next(), edge.end()And line #1098 to:
for prod in grammar.productions(lhs=edge.next()):And line #1219 to:
lhs=left_edge.next()):
>>> nltk.corpus.sinica_treebank.parsed_sents()[3450].draw() Traceback (most recent call last): File "...\lib\site-packages\nltk\tree.py", line 1337, in sinica_parse treebank_string = string.join(tokens) AttributeError: 'module' object has no attribute 'join'And again an error 2to3 should have corrected. Change line #1337 in tree.py:
treebank_string = ' '.join(tokens)While here, change line #238, to take care of the next error:
if not filter or filter(self):
Done with chapter eight.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.