Package nltk :: Package model :: Module api :: Class ModelI
[hide private]
[frames] | no frames]

Class ModelI

source code

object --+
         |
        ModelI
Known Subclasses:

A processing interface for assigning a probability to the next word.

Instance Methods [hide private]
 
__init__(self)
Create a new language model.
source code
 
prob(self, word, context)
Evaluate the probability of this word in this context.
source code
 
logprob(self, word, context)
Evaluate the log probability of this word in this context.
source code
 
choose_random_word(self, context)
Randomly select a word that is likely to appear in this context.
source code
 
generate(self, n)
Generate n words of text from the language model.
source code
 
entropy(self, text)
Evaluate the total entropy of a message with respect to the model.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Create a new language model.

Overrides: object.__init__

entropy(self, text)

source code 

Evaluate the total entropy of a message with respect to the model. This is the sum of the log probability of each word in the message.