Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions flatcat/categorizationscheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,15 +616,15 @@ def estimate_contexts(self, old_morphs, new_morphs, max_contexts=None):
if i == 0:
# Prefix inherits left perplexity of leftmost parent
l_ppl = self._contexts[old_morphs[0]].left_perplexity
if not uncapped_ppl:
if not uncapped_ppl and max_contexts is not None:
l_ppl = min(l_ppl, max_ppl)
else:
# Otherwise assume that the morph doesn't appear in any
# other contexts, which gives perplexity 1.0
l_ppl = 1.0
if i == len(new_morphs) - 1:
r_ppl = self._contexts[old_morphs[-1]].right_perplexity
if not uncapped_ppl:
if not uncapped_ppl and max_contexts is not None:
r_ppl = min(r_ppl, max_ppl)
else:
r_ppl = 1.0
Expand Down