NodeBox

Create visual output with Python programming code
Home Download Reference Tutorial Library Gallery About

hyponym()

Syntax

hyponym(query)

Description

Returns the implementation of query. This can usually be considered as an "example" of the given query. The returned value is a list of elements which are themselves a list of related synonyms. For a more extensive search of hyponyms, use the hyponyms() command.

Example

import wordnet
print wordnet.hyponym("train")
>>>[['boat train'], ['car train'], ['freight train', 'rattler'],
>>> ['hospital train'], ['mail train'], ['passenger train'], 
>>> ['streamliner'], ['subway train']]

You can walk through a list of lists as follows:

for implementation in wordnet.hyponym("train"):
  for synonym in implementation:
    print synonym

>>>boat train
>>>car train
>>>freight train
>>>rattler
>>>hospital train
>>>mail train
>>>passenger train
>>>streamliner
>>>subway train