nihitsaxena95/sentence-similarity-wordnet-sementic

AttributeError: 'Synset' object has no attribute 'wup_similarity'

Krith-man opened this issue · 2 comments

Hello sir! I tried to run your code for my project purposes and I get this AttributeError. How should I fix it ? Thanks for your time.

do this import:
from nltk.corpus import wordnet as wn
and then replace the line
similarity = a1.wup_similarity(a2)
with
similarity = wn.synset(a1.name()).wup_similarity(wn.synset(a2.name()))

You can find slightly more explanation of what's going on from here