alvations / pywsd

Python Implementations of Word Sense Disambiguation (WSD) Technologies.
MIT License
744 stars 132 forks source link

Error with adapted_lesk #32

Closed giahung24 closed 6 years ago

giahung24 commented 7 years ago

Hi, I got this error when calling adapted_lesk

 File "concept_extraction/wordnet_extractor.py", line 78, in annotate_wordnet_concept_lesk
    synset = adapted_lesk(text_split, pos[0], 'n')
  File "/users/iris/gnguyen/miniconda3/lib/python3.5/site-packages/pywsd/lesk.py", line 197, in adapted_lesk
    signature = [lemmatize(i) for i in signature]
UnboundLocalError: local variable 'signature' referenced before assignment

Can you check what is possible reason? Thank you,

bdubbs09 commented 7 years ago

Are you still having the same issue? I am as well. It works perfectly in some cases, then others I get this same error. On Stack it says that there is an issue with the variable not being global, but if thats the case, I'm not sure why it works sometimes and not others.

giahung24 commented 7 years ago

I did not dive into it since then. I gave it up.

bdubbs09 commented 7 years ago

Gotcha. I got it to work... somehow. But the function still gets overwhelmed if you use it in a loop(?). Oh well. Guess I'll find some workaround.

alvations commented 6 years ago

I've just upgraded the adapted_lesk() and the other *_lesk() functions. Let me know if you're still having the problems regarding this. The error should not be there anymore in pywsd>=1.1.1

Do re-open this issue if the problem re-surface.