If not using POS feature to dependency, error occurred.
changukshin opened this issue · 1 comments
changukshin commented
taggers.py
def parse_sentence(self, tokens):
if self.use_pos:
tokens = self.pos_tagger.tag_tokens(tokens, return_tokens=True)
#if not using pos. tokens are not tuple.
for token in tokens:
if self.use_pos:
word, pos = token
else:
pos = None
#if not using pos, word is referenced before assignment
tokens_obj.append(attributes.Token(word, pos=pos))
Here is my traceback
PC:2016_NLPNET user$ python bin/nlpnet-tag.py dependency
It was home.
Traceback (most recent call last):
File "bin/nlpnet-tag.py", line 120, in <module>
interactive_running(args)
File "bin/nlpnet-tag.py", line 48, in interactive_running
result = tagger.tag(text)
File "/Users/username/anaconda/lib/python2.7/site-packages/nlpnet/taggers.py", line 398, in tag
return self.parse(text)
File "/Users/username/anaconda/lib/python2.7/site-packages/nlpnet/taggers.py", line 336, in parse
parsed = self.parse_sentence(sent)
File "/Users/username/anaconda/lib/python2.7/site-packages/nlpnet/taggers.py", line 369, in parse_sentence
tokens_obj.append(attributes.Token(word, pos=pos))
UnboundLocalError: local variable 'word' referenced before assignment
erickrf commented
Sorry for the delay, I haven't had much time to look at nlpnet, but I'll try to check it this week.