alvations / pywsd

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

Maxsimiliarity Algorithm #49

Closed deepak8888 closed 5 years ago

deepak8888 commented 5 years ago

Maxsimiliarity Algorithm is not giving correct results. Results Obtained:

disambiguate('I went to the bank to deposit my money', algorithm=maxsim, similarity_option='wup', keepLemmas=True) [('I', 'i', None), ('went', 'go', Synset('travel.v.01')), ('to', 'to', None), ('the', 'the', None), ('bank', 'bank', None), ('to', 'to', None), ('deposit', 'deposit', Synset('deposit.v.02')), ('my', 'my', None), ('money', 'money', None)]

Expected Result:

[('I', 'i', None), ('went', u'go', Synset('sound.v.02')), ('to', 'to', None), ('the', 'the', None), ('bank', 'bank', Synset('bank.n.06')), ('to', 'to', None), ('deposit', 'deposit', Synset('deposit.v.02')), ('my', 'my', None), ('money', 'money', Synset('money.n.01'))]

It is not disambiguating nouns.

alvations commented 5 years ago

@deepak8888 sorry there was some weird bugs upstream in the wordnet reader.

Please upgrade your pywsd version.

pip install -U pywsd

(Note: the new version only supports Python 3)

With the new version, pywsd>=1.2.0:


>>> from pywsd import disambiguate                                   
>>> from pywsd.similarity import max_similarity as maxsim

>>> disambiguate('I went to the bank to deposit my money')

[('I', None), ('went', Synset('run_low.v.01')), ('to', None), ('the', None), 
('bank', Synset('depository_financial_institution.n.01')), ('to', None), 
('deposit', Synset('deposit.v.02')), ('my', None), ('money', Synset('money.n.03'))]