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

pos mismatch breaks similiarity #55

Open
aponty opened this issue Jun 10, 2019 · 0 comments
Open

pos mismatch breaks similiarity #55

aponty opened this issue Jun 10, 2019 · 0 comments

Comments

@aponty
Copy link

aponty commented Jun 10, 2019

Love the tool! Super helpful. However, it bugs out if you try to run the maxsim disambiguation on a sentence where the wn.sysnet pos doesn't match the NLTK tagged pos.

Try running

sen = 'these potato chips are great'
disambiguate(sen, algorithm=maxsim)

and you get an index out of range error because result in max_similarity in similarity.py is [], because wn.synsets(ambiguous_word, pos=pos) is nothing as NLTK has (incorrectly) decided the part of speach of 'Potato' is an adjective, and there's no synset for that.

A very simple fix- change line 114 from

for i in wn.synsets(ambiguous_word, pos=pos):

to

for i in wn.synsets(ambiguous_word, pos=pos) or wn.synsets(ambiguous_word):

to provide a fallback option

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

1 participant