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

Module synset

source code

Classes [hide private]
  Word
  WordSense
A single word-sense pairing, indicated by in WordNet by a sense key of the form:
  Synset
A set of synonyms.
Functions [hide private]
 
_index(key, sequence, testfn=None, keyfn=None)
Return the index of key within sequence, using testfn for comparison and transforming items of sequence by keyfn first.
source code
 
_partition(sequence, size, count)
Partition sequence into count subsequences of length size, and a remainder.
source code
 
_compareInstances(a, b, fields)
Return -1, 0, or 1 according to a comparison first by type, then by class, and finally by each of fields.
source code
 
_equalsIgnoreCase(a, b)
Return true iff a and b have the same lowercase representation.
source code
 
demo() source code
Variables [hide private]
  _RELATION_TABLE = {'!': 'antonym', '#m': 'member meronym', '#p...
  abbreviations = 'adverb adv adv. r'
  pos = 'adv'
  token = 'r'
  tokens = ['adverb', 'adv', 'adv.', 'r']
Function Details [hide private]

_index(key, sequence, testfn=None, keyfn=None)

source code 

Return the index of key within sequence, using testfn for comparison and transforming items of sequence by keyfn first.

>>> _index('e', 'hello')
1
>>> _index('E', 'hello', testfn=_equalsIgnoreCase)
1
>>> _index('x', 'hello')

_partition(sequence, size, count)

source code 

Partition sequence into count subsequences of length size, and a remainder.

Return (partitions, remainder), where partitions is a sequence of count subsequences of cardinality size, and apply(append, partitions) + remainder == sequence.

_compareInstances(a, b, fields)

source code 

Return -1, 0, or 1 according to a comparison first by type, then by class, and finally by each of fields. Used when comparing two Wordnet objects (Synsets, Words, or Senses) to each other.

_equalsIgnoreCase(a, b)

source code 

Return true iff a and b have the same lowercase representation.

>>> _equalsIgnoreCase('dog', 'Dog')
True
>>> _equalsIgnoreCase('dOg', 'DOG')
True

Variables Details [hide private]

_RELATION_TABLE

Value:
{'!': 'antonym',
 '#m': 'member meronym',
 '#p': 'part meronym',
 '#s': 'substance meronym',
 '$': 'verb group',
 '%m': 'member holonym',
 '%p': 'part holonym',
 '%s': 'substance holonym',
...