Get A Full List Of All Hyponyms
Solution 1:
Use the Synset.closure()
function:
from nltk.corpus import wordnet as wn
relative = wn.synsets('relative', 'n')[0]
hypos = lambda s:s.hyponyms()
print(list(relative.closure(hypos)))
[out]:
[Synset('agnate.n.01'), Synset('ancestor.n.01'), Synset('blood_relation.n.01'), Synset('cousin.n.01'), Synset('descendant.n.01'), Synset('enate.n.01'), Synset('in-law.n.01'), Synset('kin.n.01'), Synset('kinsman.n.01'), Synset('kinswoman.n.01'), Synset('kissing_cousin.n.01'), Synset('next_of_kin.n.01'), Synset('offspring.n.01'), Synset('second_cousin.n.01'), Synset('sibling.n.01'), Synset('spouse.n.01'), Synset('ancestress.n.01'), Synset('forebear.n.01'), Synset('forefather.n.01'), Synset('foremother.n.01'), Synset('progenitor.n.01'), Synset('child.n.04'), Synset('scion.n.01'), Synset('brother-in-law.n.01'), Synset('daughter-in-law.n.01'), Synset('father-in-law.n.01'), Synset('mother-in-law.n.01'), Synset('sister-in-law.n.01'), Synset('son-in-law.n.01'), Synset('affine.n.01'), Synset('male_sibling.n.01'), Synset('nephew.n.01'), Synset('uncle.n.01'), Synset('aunt.n.01'), Synset('female_sibling.n.01'), Synset('niece.n.01'), Synset('baby.n.02'), Synset('bastard.n.02'), Synset('child.n.02'), Synset('firstborn.n.01'), Synset('grandchild.n.01'), Synset('successor.n.03'), Synset('half_blood.n.01'), Synset('quadruplet.n.02'), Synset('quintuplet.n.02'), Synset('triplet.n.02'), Synset('twin.n.01'), Synset('bigamist.n.01'), Synset('consort.n.01'), Synset('helpmate.n.01'), Synset('husband.n.01'), Synset('monogamist.n.01'), Synset('newlywed.n.01'), Synset('polygamist.n.01'), Synset('wife.n.01'), Synset('grandparent.n.01'), Synset('great_grandparent.n.01'), Synset('patriarch.n.03'), Synset('genitor.n.01'), Synset('brother.n.01'), Synset('great-nephew.n.01'), Synset('great-uncle.n.01'), Synset('great-aunt.n.01'), Synset('maiden_aunt.n.01'), Synset('sister.n.01'), Synset('great-niece.n.01'), Synset('army_brat.n.01'), Synset('baby.n.01'), Synset('female_offspring.n.01'), Synset('male_offspring.n.01'), Synset('stepchild.n.01'), Synset('granddaughter.n.01'), Synset('grandson.n.01'), Synset('great_grandchild.n.01'), Synset('fraternal_twin.n.01'), Synset('identical_twin.n.01'), Synset('prince_consort.n.01'), Synset('benedick.n.01'), Synset('cuckold.n.01'), Synset('family_man.n.01'), Synset('house_husband.n.01'), Synset('uxoricide.n.01'), Synset('bride.n.01'), Synset('groom.n.03'), Synset('polyandrist.n.01'), Synset('polygynist.n.01'), Synset('battle-ax.n.02'), Synset('crown_princess.n.01'), Synset('first_lady.n.02'), Synset('golf_widow.n.01'), Synset('honest_woman.n.01'), Synset('housewife.n.01'), Synset('marchioness.n.01'), Synset('matron.n.01'), Synset('mayoress.n.01'), Synset('missus.n.01'), Synset('old_lady.n.01'), Synset('sheika.n.01'), Synset('signora.n.01'), Synset('trophy_wife.n.01'), Synset('uxor.n.01'), Synset('vicereine.n.01'), Synset('viscountess.n.01'), Synset('grandfather.n.01'), Synset('grandma.n.01'), Synset('great_grandfather.n.01'), Synset('great_grandmother.n.01'), Synset('antediluvian.n.01'), Synset('jacob.n.02'), Synset('simeon.n.01'), Synset('parent.n.01'), Synset('big_brother.n.02'), Synset('little_brother.n.01'), Synset('stepbrother.n.01'), Synset('big_sister.n.01'), Synset('half_sister.n.01'), Synset('little_sister.n.01'), Synset('blue_baby.n.01'), Synset('cherub.n.01'), Synset('foundling.n.01'), Synset('godchild.n.01'), Synset('neonate.n.01'), Synset('nursling.n.01'), Synset('papoose.n.01'), Synset('test-tube_baby.n.01'), Synset('war_baby.n.01'), Synset('daughter.n.01'), Synset('son.n.01'), Synset('stepdaughter.n.01'), Synset('stepson.n.01'), Synset('great_granddaughter.n.01'), Synset('great_grandson.n.01'), Synset('siamese_twin.n.01'), Synset('wittol.n.01'), Synset('war_bride.n.01'), Synset('nan.n.01'), Synset('adoptive_parent.n.01'), Synset('empty_nester.n.01'), Synset('father.n.01'), Synset('filicide.n.01'), Synset('mother.n.01'), Synset('stepparent.n.01'), Synset('goddaughter.n.01'), Synset('godson.n.01'), Synset('liveborn_infant.n.01'), Synset('low-birth-weight_baby.n.01'), Synset('postmature_infant.n.01'), Synset('premature_baby.n.01'), Synset('small-for-gestational-age_infant.n.01'), Synset('stillborn_infant.n.01'), Synset('term_infant.n.01'), Synset('mother's_daughter.n.01'), Synset('junior.n.04'), Synset('mother's_boy.n.01'), Synset('dad.n.01'), Synset('old_man.n.03'), Synset('pater.n.01'), Synset('ma.n.01'), Synset('mater.n.01'), Synset('primipara.n.01'), Synset('puerpera.n.01'), Synset('quadripara.n.01'), Synset('quintipara.n.01'), Synset('supermom.n.01'), Synset('surrogate_mother.n.01'), Synset('stepfather.n.01'), Synset('stepmother.n.01')]
Post a Comment for "Get A Full List Of All Hyponyms"