From 8d4fccb0127081da30eb7baa8ece7cae9176a370 Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 6 Jan 2022 04:19:36 +0100 Subject: =?UTF-8?q?G=C3=A9n=C3=A9ration=20de=20tous=20les=20cha=C3=AEnes?= =?UTF-8?q?=20=C3=A0=20une=20certaine=20distance?= 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.2.3