Skip to content

If not using POS feature to dependency, error occurred. #21

Description

@changukshin
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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions