diff options
author | ache <ache@ache.one> | 2022-01-06 04:19:36 +0100 |
---|---|---|
committer | ache <ache@ache.one> | 2022-01-06 04:19:36 +0100 |
commit | 8d4fccb0127081da30eb7baa8ece7cae9176a370 (patch) | |
tree | edc1eed1b62e4f8d91427c9d65001b51e0fb73be | |
parent | Ajout d'une correction orthographique (diff) |
Génération de tous les chaînes à une certaine distance
-rwxr-xr-x | dfr.py | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -67,6 +67,11 @@ def didYouMean(word): memo[word[:i] + c + word[i:]] = True yield word[:i] + c + word[i:] + # Insert at the end + for c in alpha: + memo[word + c] = True + yield word + c + for i in range(len(word)): if word[:i] + word[i + 1:] not in memo: memo[word[:i] + word[i + 1:]] = True |