In [6]:
from nltk.corpus import wordnet as wn

In [13]:
wn.synset('cattle.n.01').hypernyms()


Out[13]:
[Synset('bovine.n.01')]

In [25]:
bovine = wn.synset('bovine.n.01')
cattle = wn.synset('cattle.n.01')
cow = wn.synset('cow.n.01')

In [29]:
cow.wup_similarity(bovine)


Out[29]:
0.9411764705882353

In [30]:
wn.synsets('cow')


Out[30]:
[Synset('cow.n.01'),
 Synset('cow.n.02'),
 Synset('cow.n.03'),
 Synset('overawe.v.01')]

In [32]:
wn.synset('cow.n.01').hypernyms()


Out[32]:
[Synset('cattle.n.01')]

In [ ]: