JuliaText / WordNet.jl

A Julia package for Princeton's WordNet®.
Other
35 stars 11 forks source link

Hypernyms should always return a set #19

Closed mboratko closed 5 years ago

mboratko commented 5 years ago

Previously, the hypernyms function was only returning a single synset, however there are some synsets with multiple hypernyms, eg. "lactate".

These changes make it so that hypernyms work the same as the other functions (antonyms and hyponyms), and abstracts the expanded_hypernym code to a general breadth-first-search expanded_relation function, which allows for expanded_hyponyms as well.

mboratko commented 5 years ago

The tests failed because of the change in the return type (relation returning a set instead of an array), however I would argue that this is the correct return type in principle, so the downstream functions should be changed to expect a set as output.

oxinabox commented 5 years ago

Thanks. I really like the expanded_relation and hyponym, support.

I am a little 🤷 to the change of everything to be Sets. Because sets are generally slower than short vectors for all set operations in practice. Because checking a vector of ~5 elements can be done in less time than most hash operations. And wordnet relations are generally very small sets.

oxinabox commented 5 years ago

@mboratko how is this going?

oxinabox commented 5 years ago

LGTM, Thanks! nice first contribution