Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
wordnet lowest_common_hypernyms() returning different results in Python 2.7 vs 3.3 (doctest failing in py 3.3 on OS X) #458
As in pull request 451, sometimes wordnet lch returns differently ordered lists in python 2.7 vs 3.3 on OS X.
Possible fix is to return a set rather than a list, but that seems to be a major change for a small problem. Any suggestions? I'll try finding the source of the difference, anyway.
Lines 511 and 514 indeed iterate over a set.
Since the behavior has changed (see
Yes, all of the synset and lemma methods would need to return sets. In most cases, the sequence comes straight from the wordnet file, so the above-mentioned problem would never arise, and we are doing extra processing for no reason (other than theoretical correctness). A downside is that user code would become non-deterministic. I prefer a more conservative fix, namely sorting the result of lowest_common_hypernyms().
On Thu, Aug 22, 2013 at 4:46 PM, Steven Bird firstname.lastname@example.org wrote:
Do you really mean all? Synsets and lemmas are ordered in wordnet by
For obvious reasons, hypernym_paths is definitely a list.
In cases where the ordering is meaningful, of course we should not change it.
Code that iterates through lowest_common_hypernyms() would possibly change.
We could impose an order and document it (maybe depth, then frequency,
Francis Bond http://www3.ntu.edu.sg/home/fcbond/