Skip to content

Commit b15b429

Browse files
committed
fix: doc correction
1 parent c482b18 commit b15b429

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

strings/damerau_levenshtein_distance.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
def damerau_levenshtein_distance(first_string: str, second_string: str) -> int:
1212
"""
1313
Implements the Damerau-Levenshtein distance algorithm that measures
14-
the edit distance between two string. This function calculates the true
15-
Damerau-Levenshtein distance with adjacent transpositions.
14+
the edit distance between two string.
1615
1716
Parameters:
1817
first_string (string): The first string
@@ -53,14 +52,13 @@ def damerau_levenshtein_distance(first_string: str, second_string: str) -> int:
5352
dp_matrix[i - 1][j - 1] + cost, # Substitution
5453
)
5554

56-
# Calculate Transposition
5755
if (
5856
i > 1
5957
and j > 1
6058
and first_string[i - 1] == second_string[j - 2]
6159
and first_string[i - 2] == second_string[j - 1]
6260
):
63-
dp_matrix[i][j] = min(dp_matrix[i][j], dp_matrix[i - 2][j - 2] + cost)
61+
dp_matrix[i][j] = min(dp_matrix[i][j], dp_matrix[i - 2][j - 2] + cost) # Transposition
6462

6563
return dp_matrix[len(first_string)][len(second_string)]
6664

0 commit comments

Comments
 (0)