A processing interface for assigning a probability to the next
word.
|
|
__init__(self,
n,
train,
estimator=None)
Creates an ngram language model to capture patterns in n consecutive
words of training text. |
source code
|
|
|
|
prob(self,
word,
context)
Evaluate the probability of this word in this context. |
source code
|
|
|
|
|
|
|
|
|
|
generate(self,
num_words,
context=())
Generate random text based on the language model. |
source code
|
|
|
|
|
|
|
entropy(self,
text)
Evaluate the total entropy of a text with respect to the model. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
Inherited from api.ModelI:
choose_random_word,
logprob
Inherited from object:
__delattr__,
__getattribute__,
__hash__,
__new__,
__reduce__,
__reduce_ex__,
__setattr__,
__str__
|