spelling: occurrences

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
This commit is contained in:
Josh Soref 2025-01-28 15:17:32 -05:00
parent 76f2f9643f
commit 9cf1456fff
2 changed files with 4 additions and 4 deletions

View file

@ -58,8 +58,8 @@ def encode(source):
frequency.update(source) frequency.update(source)
# most_common() doesn't define what happens if there's a tie in frequency. Let's always pick # most_common() doesn't define what happens if there's a tie in frequency. Let's always pick
# the lowest value of that frequency to make the encoding predictable. # the lowest value of that frequency to make the encoding predictable.
occurences = frequency.most_common() occurrences = frequency.most_common()
escape = min(x[0] for x in occurences if x[1] == occurences[-1][1]) escape = min(x[0] for x in occurrences if x[1] == occurrences[-1][1])
yield escape yield escape
for b, g in groupby(source): for b, g in groupby(source):
if b == b'\0': if b == b'\0':

View file

@ -58,8 +58,8 @@ def encode(source):
frequency.update(source) frequency.update(source)
# most_common() doesn't define what happens if there's a tie in frequency. Let's always pick # most_common() doesn't define what happens if there's a tie in frequency. Let's always pick
# the lowest value of that frequency to make the encoding predictable. # the lowest value of that frequency to make the encoding predictable.
occurences = frequency.most_common() occurrences = frequency.most_common()
escape = min(x[0] for x in occurences if x[1] == occurences[-1][1]) escape = min(x[0] for x in occurrences if x[1] == occurrences[-1][1])
yield escape yield escape
for b, g in groupby(source): for b, g in groupby(source):
if b == b'\0': if b == b'\0':