diff --git a/content/posts/2024-06-30-trie/index.md b/content/posts/2024-06-30-trie/index.md index bf79613..6017ef6 100644 --- a/content/posts/2024-06-30-trie/index.md +++ b/content/posts/2024-06-30-trie/index.md @@ -161,11 +161,11 @@ def get_fuzzy(self, key: str, max_distance: int = 0) -> Iterator[FuzzyResult[T]] yield from helper(current_word + c, child, current_row) # Build the first row -- the edit distance from the empty string - row = list(range(len(key) + 1)) + row = list(range(len(word) + 1)) # Base case for the empty string if (distance := row[-1]) <= max_distance and node._value != None: yield FuzzyResult(distance, "", node._value) for c, child in self._children.items(): - yield from helper(c, child, row) + yield from helper(c, node, row) ```