Find the best match with {word} in a trie. :arg str word: Query word. :arg int distance: Maximum allowed distance. :returns str: Best match with {word}.
(self, word, distance)
| 249 | return None |
| 250 | |
| 251 | def best_hamming(self, word, distance): |
| 252 | """Find the best match with {word} in a trie. |
| 253 | |
| 254 | :arg str word: Query word. |
| 255 | :arg int distance: Maximum allowed distance. |
| 256 | |
| 257 | :returns str: Best match with {word}. |
| 258 | """ |
| 259 | if self.get(word): |
| 260 | return word |
| 261 | |
| 262 | for i in range(1, distance + 1): |
| 263 | result = self.hamming(word, i) |
| 264 | if result is not None: |
| 265 | return result |
| 266 | |
| 267 | return None |
| 268 | |
| 269 | def all_levenshtein_(self, word, distance): |
| 270 | return map( |