Closed michael-aloys closed 5 years ago
Yes having the same issue with Python3, getting TypeError: unorderable. Must be due to the wn.path_similarity returning None.
Yes, this is quirky that the wordnet interface in NLTK was doing that for path similarity. There's some additional mechanism put in place to avoid that and no return None but 0, still now that we have the recent overhaul and depends on https://github.com/alvations/wordnet instead of NLTK's interface, we have more control over how to handle these.
Please re-open if this comes up again.
Really sorry for the really late reply! Thanks @saieccles @michael-aloys for raising this!
Hi,
I was wondering if here https://github.com/alvations/pywsd/blob/master/pywsd/similarity.py#L22-L23
the senses should be flipped in the second argument of the max function. I.e.:
return max(wn.path_similarity(sense1,sense2), wn.path_similarity(sense2,sense1))
Also, when using Python3 this call tends to crash if there exists no path. Then wn.path_similarity returns None and max(None, 1) throws an exception in Python3.
This is e.g. the case for Synset('bank.n.01') and Synset('one.s.01') which is checked when running
max_similarity('I went to the bank to deposit my money', 'bank', 'path', pos='n')