How can I know the maximum depth of the taxonomy for wordnet 3.0? (is-a relationships for synsets)
I read some papers and found from a paper that it is 16 for wordnet 1.7.1.
I'm wondering the value for wordnet 3.0.
You can try the wordnet interface in python nltk.
Iterate through each synset in wordnet and find the distance to their top most hypernym:
>>> from nltk.corpus import wordnet
>>> from nltk.corpus import wordnet as wn
>>> max(max(len(hyp_path) for hyp_path in ss.hypernym_paths()) for ss in wn.all_synsets())
20
To find the possible paths of a synset to its top most hypernym:
>>> wn.synset('dog.n.1')
Synset('dog.n.01')
>>> wn.synset('dog.n.1').hypernym_paths()
[[Synset('entity.n.01'), Synset('physical_entity.n.01'), Synset('object.n.01'), Synset('whole.n.02'), Synset('living_thing.n.01'), Synset('organism.n.01'), Synset('animal.n.01'), Synset('chordate.n.01'), Synset('vertebrate.n.01'), Synset('mammal.n.01'), Synset('placental.n.01'), Synset('carnivore.n.01'), Synset('canine.n.02'), Synset('dog.n.01')], [Synset('entity.n.01'), Synset('physical_entity.n.01'), Synset('object.n.01'), Synset('whole.n.02'), Synset('living_thing.n.01'), Synset('organism.n.01'), Synset('animal.n.01'), Synset('domestic_animal.n.01'), Synset('dog.n.01')]]
To find the maximum of one synset:
>>> max(len(hyp_path) for hyp_path in wn.synset('dog.n.1').hypernym_paths())
14
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With