Package nltk_lite :: Package model :: Class ModelI
[hide private]
[frames] | no frames]

Class ModelI

source code

object --+
         |
        ModelI

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

Instance Methods [hide private]
 
__init__(self)
Create a new language model.
source code
 
train(self, text)
Train the model on the text.
source code
 
probability(self, word, context)
Evaluate the 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
 
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.