I spotted some problems with WordNet's hierarchy for verbs.
For example,
a.lowest_common_hypernyms(wn.synset('love.v.02'))
returns []
.
Isn't there a common ancestor like entity
for verbs as well ?
Are verbs even connected to nouns in the same hierarchy ?
To find the top hypernym of any synset, use the Synset.root_hypernyms()
function, e.g.:
>>> from nltk.corpus import wordnet as wn
>>> wn.synsets('car')[0].root_hypernyms()
[Synset('entity.n.01')]
>>> wn.synsets('love')[0].root_hypernyms()
[Synset('entity.n.01')]
>>> wn.synsets('love', 'v')[0].root_hypernyms()
[Synset('love.v.01')]
It seems that there's no overarching/umbrella hypernym that covers all verbs
, unlike nouns
that covered by entity.n.01
:
>>> root_hypernyms_of_nouns = Counter(chain(*[ss.root_hypernyms() for ss in wn.all_synsets(pos='n')]))
>>> len(root_hypernyms_of_nouns)
1
>>> root_hypernyms_of_nouns.items()
[(Synset('entity.n.01'), 82115)]
But you can try to iterate through all verbs, e.g.:
wn.all_synsets(pos='v')
And try to find the top most hypernyms for verbs (it will be a rather large list):
>>> from collections import Counter
>>> from itertools import chain
>>> root_hypernyms_of_verbs = Counter(chain(*[ss.root_hypernyms() for ss in wn.all_synsets(pos='v')]))
>>> root_hypernyms_of_verbs.most_common(10)
[(Synset('change.v.01'), 1704), (Synset('change.v.02'), 1295), (Synset('act.v.01'), 1083), (Synset('move.v.02'), 1027), (Synset('make.v.03'), 659), (Synset('travel.v.01'), 526), (Synset('think.v.03'), 451), (Synset('transfer.v.05'), 420), (Synset('move.v.03'), 329), (Synset('connect.v.01'), 262)]
>>> root_hypernyms_of_verbs.keys() # This will return all root_hypernyms.
Visuwords has a very pretty interactive graph that you can use to look through the WordNet hierarchy manually, http://visuwords.com/entity