wordnet.grammar()
Syntax
grammar(type)
Description
Sets the type of grammar wordnet looks into: NOUNS (by default), VERBS, ADJECTIVES or ADVERBS. This is a state function: all subsequent commands query the same type of grammar, until this function is called with a different type.
Example
Print the meaning of fall as in falling down, not as season.
wordnet = ximport("wordnet")
wordnet.grammar(wordnet.VERBS)
print wordnet.gloss("fall")
>>>descend in free fall under the influence of gravity;
>>>"The branch fell from the tree";
>>>"The unfortunate hiker fell into a crevasse"
In some cases it might be useful to query NOUNS, VERBS, ADJECTIVES, ADVERBS directly: the following returns True; fish is a noun.
print wordnet.NOUNS.has_key("fish")
>>>True
The following returns False; breathe is not a noun.
print wordnet.NOUNS.has_key("breathe")
>>>False