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

Module dictionary

source code

Classes [hide private]
  Dictionary
A Dictionary contains all the Words in a given part of speech.
Functions [hide private]
 
dictionaryFor(pos)
Return the dictionary for the supplied part of speech.
source code
 
word(form, pos='noun')
Return a word with the given lexical form and pos.
source code
 
sense(form, pos='noun', senseno=0)
Lookup a sense by its sense number.
source code
 
synset(pos, offset)
Lookup a synset by its offset.
source code
Variables [hide private]
  N = <nltk.wordnet.dictionary.Dictionary instance for noun>
  V = <nltk.wordnet.dictionary.Dictionary instance for verb>
  ADJ = <nltk.wordnet.dictionary.Dictionary instance for adj>
  ADV = <nltk.wordnet.dictionary.Dictionary instance for adv>
  Dictionaries = {'adj': <nltk.wordnet.dictionary.Dictionary ins...
  abbreviations = 'adverb adv adv. r'
  pos = 'adv'
  token = 'r'
  tokens = ['adverb', 'adv', 'adv.', 'r']
Function Details [hide private]

dictionaryFor(pos)

source code 

Return the dictionary for the supplied part of speech.

Parameters:
  • pos (string) - The part of speech of the desired dictionary.
Returns:
The desired dictionary.

word(form, pos='noun')

source code 

Return a word with the given lexical form and pos.

Parameters:
  • form (string) - the sought-after word string e.g. 'dog'
  • pos (string) - the desired part of speech. Defaults to 'noun'.
Returns:
the Word object corresponding to form and pos, if it exists.

sense(form, pos='noun', senseno=0)

source code 

Lookup a sense by its sense number. Used by repr(sense).

Parameters:
  • form (string) - the sought-after word string e.g. 'dog'
  • pos (string) - the desired part of speech. Defaults to 'noun'.
  • senseno (int) - the id of the desired word sense. Defaults to 0.
Returns:
the Synset object corresponding to form, pos and senseno, if it exists.

synset(pos, offset)

source code 

Lookup a synset by its offset.

Parameters:
  • pos (string) - the desired part of speech.
  • offset (int) - the offset into the relevant Wordnet dictionary file.
Returns:
the Synset object extracted from the Wordnet dictionary file.

Variables Details [hide private]

Dictionaries

Value:
{'adj': <nltk.wordnet.dictionary.Dictionary instance for adj>,
 'adv': <nltk.wordnet.dictionary.Dictionary instance for adv>,
 'noun': <nltk.wordnet.dictionary.Dictionary instance for noun>,
 'verb': <nltk.wordnet.dictionary.Dictionary instance for verb>}