MCPcopy
hub / github.com/FedML-AI/FedML / best_hamming

Method best_hamming

python/fedml/fa/utils/trie.py:251–267  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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(

Callers

nothing calls this directly

Calls 2

getMethod · 0.95
hammingMethod · 0.95

Tested by

no test coverage detected