@@ -17,7 +17,7 @@ class TrieNode:
|
|||||||
|
|
||||||
def add(self, word: str, definitions: list[str] | None = None) -> None:
|
def add(self, word: str, definitions: list[str] | None = None) -> None:
|
||||||
"""Add a word to the trie."""
|
"""Add a word to the trie."""
|
||||||
word = word.lower().strip().replace("ё", "е")
|
word = word.lower().strip().replace("ё", "е") # noqa: RUF001
|
||||||
node = self
|
node = self
|
||||||
for i in range(len(word)):
|
for i in range(len(word)):
|
||||||
if word[i] not in node.children:
|
if word[i] not in node.children:
|
||||||
@@ -35,7 +35,7 @@ class TrieNode:
|
|||||||
the word is in the trie, or
|
the word is in the trie, or
|
||||||
is a prefix of a longer word.
|
is a prefix of a longer word.
|
||||||
"""
|
"""
|
||||||
word = word.lower().strip().replace("ё", "е")
|
word = word.lower().strip().replace("ё", "е") # noqa: RUF001
|
||||||
node = self
|
node = self
|
||||||
for i in range(len(word)):
|
for i in range(len(word)):
|
||||||
if word[i] not in node.children:
|
if word[i] not in node.children:
|
||||||
|
|||||||
Reference in New Issue
Block a user