makeqstrdata: Don't include strings that are a net loss!

This commit is contained in:
Jeff Epler 2021-07-09 14:16:14 -05:00
parent 8836198ff1
commit 52e75c645d
1 changed files with 2 additions and 2 deletions

View File

@ -390,8 +390,8 @@ def compute_huffman_coding(translations, compression_filename):
((s, -est_net_savings(s, occ)) for (s, occ) in counter.items()), key=lambda x: x[1]
)
# Pick the one with the highest score.
if not scores:
# Pick the one with the highest score. The score must be negative.
if not scores or scores[0][-1] >= 0:
break
word = scores[0][0]