더 구체적으로 정의 할 수 없다면 필요한 것을 얻는 명확한 방법이 없다고 생각합니다. 예를 들어 :
>>> from nltk.corpus import wordnet as wn
>>> blue = wn.synsets('blue')[0]
>>> cat = wn.synsets('cat')[0]
>>> blue.definition()
u'blue color or pigment; resembling the color of the clear sky in the daytime'
>>> cat.definition()
u'feline mammal usually having thick soft fur and no ability to roar: domestic cats; wildcats'
때때로, 당신은 행운과 hypernyms의 하나 또는 두 개의 레벨이 올라갈 :
>>> blue.hypernyms()
[Synset('chromatic_color.n.01')]
>>> blue.hypernyms()[0].hypernyms()
[Synset('color.n.01')]
때때로 당신은 당신이 원하는 무엇을 얻을 수있는 hypernyms을 많은 수준을 가야 해요.
>>> happy = wn.synsets('happy')[0]
>>> happy.definition()
u'enjoying or showing or marked by joy or pleasure'
>>> happy.hypernyms()
[]
>>> happy.root_hypernyms()
[Synset('happy.a.01')]
: 당신이 이동하는
>>> blue.root_hypernyms()
[Synset('entity.n.01')]
>>> cat.root_hypernyms()
[Synset('entity.n.01')]
이 때로는 더 상위 개념이 없습니다 :
>>> cat.hypernyms()
[Synset('feline.n.01')]
>>> cat.hypernyms()[0].hypernyms()
[Synset('carnivore.n.01')]
>>> cat.hypernyms()[0].hypernyms()[0].hypernyms()
[Synset('placental.n.01')]
>>> cat.hypernyms()[0].hypernyms()[0].hypernyms()[0].hypernyms()
[Synset('mammal.n.01')]
>>> cat.hypernyms()[0].hypernyms()[0].hypernyms()[0].hypernyms()[0].hypernyms()
[Synset('vertebrate.n.01')]
>>> cat.hypernyms()[0].hypernyms()[0].hypernyms()[0].hypernyms()[0].hypernyms()[0].hypernyms()
[Synset('chordate.n.01')]
>>> cat.hypernyms()[0].hypernyms()[0].hypernyms()[0].hypernyms()[0].hypernyms()[0].hypernyms()[0].hypernyms()
[Synset('animal.n.01')]
그리고 최상위 상위어 수준으로 점점
은별로 의미가 있습니다