From 8d4fccb0127081da30eb7baa8ece7cae9176a370 Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 6 Jan 2022 04:19:36 +0100 Subject: Génération de tous les chaînes à une certaine distance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dfr.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dfr.py b/dfr.py index 1ed5d40..3656c7e 100755 --- a/dfr.py +++ b/dfr.py @@ -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 -- cgit v1.3-2-g11bf