Skip to content

Commit 4359762

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 435f451 commit 4359762

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compression/ppm.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class PPMNode:
99
def __init__(self) -> None:
10-
# Initialize a PPMNode with a dictionary for child nodes
10+
# Initialize a PPMNode with a dictionary for child nodes
1111
# and a count of total occurrences
1212
self.counts: dict[str, PPMNode] = defaultdict(PPMNode)
1313
self.total: int = 0
@@ -48,7 +48,7 @@ def compress(self, data: str) -> list[float]:
4848
context = (context + symbol)[-self.order :] # Keep the context within order
4949

5050
return compressed_output
51-
51+
5252
def encode_symbol(self, context: str, symbol: str) -> float:
5353
# Encode a symbol based on the current context and return its probability
5454
node = self.root
@@ -93,7 +93,7 @@ def decode_symbol(self, context: str, prob: float) -> str | None:
9393
else:
9494
return None # Return None if the context is not found
9595

96-
# Iterate through the children of the node to
96+
# Iterate through the children of the node to
9797
# find the symbol matching the given probability
9898
for symbol, child in node.counts.items():
9999
if child.total / node.total == prob:

0 commit comments

Comments
 (0)