Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
changukshin opened this issue Jan 28, 2016 · 1 comment
Open

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

changukshin opened this issue Jan 28, 2016 · 1 comment

Comments

@changukshin
Copy link

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
Copy link
Owner

erickrf commented Feb 22, 2016

Sorry for the delay, I haven't had much time to look at nlpnet, but I'll try to check it this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants