wordnet 3.0分类的最大深度

GUA*_*IAO 3 taxonomy wordnet depth

我如何知道Wordnet 3.0分类的最大深度?(是同义词集的关系)

我阅读了一些论文,并从一篇论文中发现wordnet 1.7.1为16。

我想知道wordnet 3.0的价值。

alv*_*vas 5

您可以wordnet在python中尝试该接口nltk

遍历wordnet中的每个同义词集,并找到与其最上位的上位词的距离:

>>> 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
Run Code Online (Sandbox Code Playgroud)

要查找同义词集到其最高上位词的可能路径:

>>> 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')]]
Run Code Online (Sandbox Code Playgroud)

要查找一个同义词集的最大值:

>>> max(len(hyp_path) for hyp_path in wn.synset('dog.n.1').hypernym_paths())
14
Run Code Online (Sandbox Code Playgroud)