Skip to content

Commit f2a92bd

Browse files
mbauwensiliakur
andauthored
Add reference to entropy implementation used (nltk#3229)
* Add reference to entropy implementation used Making it more clear that the entropy implementation in NLTK is the one based on the Shannon-McMillan-Breiman theorem, as used and referenced by Jurafsky and Jordan Boyd-Graber. * Consistently use full names Co-authored-by: Ilia Kurenkov <[email protected]> * Consistency with other docstrings in the module Co-authored-by: Ilia Kurenkov <[email protected]> --------- Co-authored-by: Ilia Kurenkov <[email protected]>
1 parent 00de04b commit f2a92bd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

nltk/lm/api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ def context_counts(self, context):
163163
def entropy(self, text_ngrams):
164164
"""Calculate cross-entropy of model for given evaluation text.
165165
166+
This implementation is based on the Shannon-McMillan-Breiman theorem,
167+
as used and referenced by Dan Jurafsky and Jordan Boyd-Graber.
168+
166169
:param Iterable(tuple(str)) text_ngrams: A sequence of ngram tuples.
167170
:rtype: float
168171

0 commit comments

Comments
 (0)