transition_log_probability(self,
state,
previous_state)
| source code
|
Gives the probability P(label_i | label_(i-1), ..., label_(i-n)),
where the previous labels are given in the sequence label_context. The
context should be in reverse order, i.e. with the most recent label at
the start.
Note that this is the probability of a label given the previous n-1
labels, which is the same as the probability of the n-gram [label_i, ...,
label_(i-n+1)] given the ngram [label_(i-1), ..., label_(i-n)], since all
but the last element of the ngram overlaps with the condition, so has
probability 1.
Caches all computed transition probabilities. This is particularly
important for backoff models. Many n-grams will back off to the same
(n-1)-gram and we don't want to recompute the transition probability for
that each time.
- Overrides:
utils.nltk.ngram.model.NgramModel.transition_log_probability
- (inherited documentation)
|