Package nltk :: Package wordnet :: Module synset :: Class Word
[hide private]
[frames] | no frames]

Class Word

source code

object --+
         |
        Word

Instance Methods [hide private]
 
__init__(self, line)
Extract a word from a line of a WordNet POS file.
source code
 
synsets(self)
Get a sequence of the synsetss of this word.
source code
 
senses(self)
Return a list of WordSense objects corresponding to this word's synsets.
source code
 
senseCounts(self)
Return the frequencies of each sense of this word in a tagged concordance.
source code
 
isTagged(self) source code
 
__getitem__(self, idx) source code
 
__iter__(self) source code
 
__contains__(self, item) source code
 
__getslice__(self, i, j) source code
 
__len__(self) source code
 
__repr__(self)
repr(x)
source code
 
__str__(self)
str(x)
source code
 
__cmp__(self, other) source code
 
__hash__(self)
hash(x)
source code

Inherited from object: __delattr__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, line)
(Constructor)

source code 

Extract a word from a line of a WordNet POS file.

Parameters:
  • line (string) - The appropriate line taken from the Wordnet data files.
Overrides: object.__init__

synsets(self)

source code 

Get a sequence of the synsetss of this word.

>>> from nltk.wordnet import *
>>> N['dog'].synsets()
[{noun: dog, domestic dog, Canis familiaris}, {noun: frump, dog}, {noun: dog}, {noun: cad, bounder, blackguard, dog, hound, heel}, {noun: frank, frankfurter, hotdog, hot dog, dog, wiener, wienerwurst, weenie}, {noun: pawl, detent, click, dog}, {noun: andiron, firedog, dog, dog-iron}]
Returns:
A list of this Word's Synsets

isTagged(self)

source code 
>>> from nltk.wordnet import *
>>> N['dog'].isTagged()
True
Returns:
True/false (1/0) if one of this Word's senses is tagged.

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

__hash__(self)
(Hashing function)

source code 

hash(x)

Overrides: object.__hash__
(inherited documentation)