Home | Trees | Indices | Help |
|
---|
|
object --+ | Synset
A set of synonyms.
Each synset contains one or more Senses, which represent a specific sense of a specific word. Senses can be retrieved via synset.senses() or through the index notations synset[0], synset[string], or synset[word]. Synsets participate in lexical relations, which can be accessed via synset.relations().
>>> from nltk.wordnet import * >>> N['dog'][0] {noun: dog, domestic_dog, Canis_familiaris} >>> N['dog'][0][HYPERNYM] [{noun: canine, canid}, {noun: domestic_animal, domesticated_animal}] >>> V['think'][0].verbFrameStrings ['Something think something Adjective/Noun', 'Somebody think somebody']
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
string
|
gloss A gloss (dictionary definition) for the sense. |
||
int
|
offset An integer offset into the part-of-speech file. |
||
string
|
pos The part of speech -- one of NOUN, VERB, ADJECTIVE, ADVERB. |
||
list of integer
|
verbFrames A sequence of integers that index into VERB_FRAME_STRINGS. |
|
|||
Inherited from |
|
Initialize the synset from a line in a WordNet lexicographer file.
|
Return a dictionary of synsets, one per lexical relation
|
>>> from nltk.wordnet import * >>> N['dog'][0].isTagged() True >>> N['dog'][1].isTagged() False
|
Return a human-readable representation. >>> from nltk.wordnet import * >>> str(N['dog'][0].synset) '{noun: dog, domestic dog, Canis familiaris}'
|
repr(x)
|
hash(x)
|
|
|
Return the transitive closure of source under the rel relationship, breadth-first >>> dog = N['dog'][0] >>> dog.closure(HYPERNYM) [{noun: dog, domestic dog, Canis familiaris}, {noun: canine, canid}, {noun: carnivore}, {noun: placental, placental mammal, eutherian, eutherian mammal}, {noun: mammal, mammalian}, {noun: vertebrate, craniate}, {noun: chordate}, {noun: animal, animate being, beast, brute, creature, fauna}, {noun: organism, being}, {noun: living thing, animate thing}, {noun: object, physical object}, {noun: physical entity}, {noun: entity}] |
Get the path(s) from this synset to the root, where each path is a list of the synset nodes traversed on the way to the root.
|
Get the path(s) from this synset to the root, counting the distance of each node from the initial node on the way. A list of (synset, distance) tuples is returned. |
Returns the distance of the shortest path linking the two synsets (if one exists). For each synset, all the ancestor nodes and their distances are recorded and compared. The ancestor node common to both synsets that can be reached with the minimum number of traversals is used. If no ancestor nodes are common, -1 is returned. If a node is compared with itself 0 is returned.
|
|
offsetAn integer offset into the part-of-speech file. Together with pos, this can be used as a unique id.
|
verbFramesA sequence of integers that index into VERB_FRAME_STRINGS. These list the verb frames that any Sense in this synset participates in. (See also Sense.verbFrames.) Defined only for verbs.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Wed Aug 27 15:08:59 2008 | http://epydoc.sourceforge.net |