Closed AvinashReddyRangu closed 7 years ago
Ah, absolute vs local import issues. I'll be fixing that when evening comes.
Hi
I am using python 3.5.2
i have installed pywsd via pip install pywsd
ran >>> import pywsd
Traceback (most recent call last):
File "
when i run from pywsd.lesk import simple_lesk
i get this error
Traceback (most recent call last):
File "F:/Anthem/pywsd1.py", line 2, in
please help me to install it
@AvinashReddyRangu it won't work for Python3 until I get it patched up tonight =)
I should work fine for Python2 though. Sorry for the slight delay.
It should be fixed now. Please do:
pip3 install -U pywsd
On my machine:
$ pip3 install pywsd
Collecting pywsd
Downloading pywsd-1.0.2.tar.gz
Requirement already satisfied: nltk in /usr/local/lib/python3.5/site-packages (from pywsd)
Requirement already satisfied: numpy in /usr/local/lib/python3.5/site-packages (from pywsd)
Requirement already satisfied: six in /usr/local/lib/python3.5/site-packages (from nltk->pywsd)
Building wheels for collected packages: pywsd
Running setup.py bdist_wheel for pywsd ... done
Stored in directory: /Users/liling.tan/Library/Caches/pip/wheels/45/2b/e5/e965d8cb30c8e654b06fd5b9b8ce9ee63cca8d291def3476fe
Successfully built pywsd
Installing collected packages: pywsd
Successfully installed pywsd-1.0.2
$ python3
Python 3.5.2 (default, Oct 11 2016, 04:59:56)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pywsd
>>> from pywsd import disambiguate
>>> from pywsd.lesk import simple_lesk
>>> sent = 'I went to the bank to deposit my money'
>>> ambiguous = 'bank'
>>> answer = simple_lesk(sent, ambiguous, pos='n')
>>> answer
Synset('bank.n.09')
>>> disambiguate('I went to the bank to deposit my money')
[('I', None), ('went', Synset('run_low.v.01')), ('to', None), ('the', None), ('bank', Synset('bank.n.09')), ('to', None), ('deposit', Synset('deposit.v.02')), ('my', None), ('money', Synset('money.n.03'))]
>>> from pywsd.similarity import max_similarity as maxsim
>>> disambiguate('I went to the bank to deposit my money', algorithm=maxsim, similarity_option='wup', keepLemmas=True)
[('I', 'i', None), ('went', 'go', Synset('sound.v.02')), ('to', 'to', None), ('the', 'the', None), ('bank', 'bank', None), ('to', 'to', None), ('deposit', 'deposit', Synset('deposit.v.02')), ('my', 'my', None), ('money', 'money', None)]
Thanks for the quick response . Its working now
I'm getting the same error with an up to date version of pywsd:
AttributeError Traceback (most recent call last)
@DStickley Thank you for reporting the issue!
Please try to upgrade the pywsd
again, pip install -U pywsd
, you should see version 1.2.4 that solves this issue for Python 3.6
Example: https://colab.research.google.com/drive/1X8ulJfd5Mqy4KGPZTL5A5vAcsA5sJ4BU
i get the error : ImportError: cannot import name 'WordNet' when trying to "from pywsd.lesk import simple_lesk"
i get the error : ImportError: cannot import name 'WordNet' when trying to "from pywsd.lesk import simple_lesk"
I am getting the same error, please fix
hi how to install pywsd for python 3 via pip? I am getting error when i run from pywsd.lesk import simple_lesk ImportError: No module named 'lesk'