Text

Levenshtein Distance

Compare two strings and get the edit distance — the fewest single-character insertions, deletions, and substitutions that turn one into the other. Shows the actual edits it picked, and the dynamic programming matrix with the cheapest path traced through it.

Edit Distance

3

3 edits turn A into B

Similarity (1 − distance ÷ length of the longer string)

57.1%

Substitutions

2

changed in place

Insertions

1

added to reach B

Deletions

0

dropped from A

Hamming

needs equal lengths

The Edits (A on top, B below, read left to right)

k~s
i=i
t=t
t=t
e~i
n=n
·+g
=kept~substituted+inserteddeleted

Dynamic Programming Matrix (each cell is the distance between the prefixes; the shaded run is the cheapest path)

εsitting
ε01234567
k11234567
i22123456
t33212345
t44321234
e55432234
n66543323

Bottom-right corner = the answer. 4 of 7 positions needed no edit at all.

Share

marduc812

© 202620260824_1c411cc