user1054927
user1054927

Reputation:

How do I check hyponym relationship in WordNet using NLTK?

I'm looking for an efficient way to check if A is a hyponym of B in WordNet using NLTK.

I could use lowest_common_hypernyms to check if the lowest common hypernym of A and B is B, which means that A is a hyponym of B, but the problem is that B could be a hyponym of A.

Is there any single function that checks this?

Upvotes: 0

Views: 1319

Answers (1)

David
David

Reputation: 91

motorcar = wn.synset('car.n.01')
types_of_motorcar = motorcar.hyponyms()
types_of_motorcar[26]

Upvotes: 2

Related Questions