From 6c79ba93795091c4d2c6330ec66f44b7d6b985f9 Mon Sep 17 00:00:00 2001 From: Florian Kaiser Date: Tue, 10 Jan 2023 12:50:24 +0100 Subject: [PATCH] =?UTF-8?q?=E2=80=9Esimilarity.py=E2=80=9C=20=C3=A4ndern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- similarity.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/similarity.py b/similarity.py index cbe8dbb..1505b65 100644 --- a/similarity.py +++ b/similarity.py @@ -60,10 +60,12 @@ def edit_distance(word_1: str, word_2: str, to_same_case: bool = True) -> int: # not in the beginning or the end if i > 0 and i < len(word_1): - # previous char is same and current char of word_1 is same as next char of word_2 - # -> fill current char of word_2 between last and next char of word_1 - # e.g. word_1[i-1] = "M" ; word_1[i] = "R" - # word_2[i-1] = "M" ; word_1[i] = "A" ; word_2[i+1] = "R" + """ + previous char is same and current char of word_1 is same as next char of word_2 + -> fill current char of word_2 between last and next char of word_1 + e.g. word_1[i-1] = "M" ; word_1[i] = "R" + word_2[i-1] = "M" ; word_1[i] = "A" ; word_2[i+1] = "R" + """ if word_1[i-1] == word_2[i-1] and word_1[i] == word_2[i+1]: word_1.insert(i, word_2[i]) count += 1