diff --git a/nltk/lm/api.py b/nltk/lm/api.py index 5ebdf38ed4..1da6719165 100644 --- a/nltk/lm/api.py +++ b/nltk/lm/api.py @@ -163,6 +163,9 @@ def context_counts(self, context): def entropy(self, text_ngrams): """Calculate cross-entropy of model for given evaluation text. + This implementation is based on the Shannon-McMillan-Breiman theorem, + as used and referenced by Dan Jurafsky and Jordan Boyd-Graber. + :param Iterable(tuple(str)) text_ngrams: A sequence of ngram tuples. :rtype: float