Handbook
Glossary
levenshtein ( old new -- n )
LCS, diffing and distance
Prev:
lcs-diff ( old new -- diff )
Next:
insert
Vocabulary
lcs
Inputs
old
a
sequence
new
a
sequence
Outputs
n
the Levenshtein distance
Word description
Calculates the Levenshtein distance between old and new, that is, the minimal number of changes from the old sequence to the new one, in terms of deleting, inserting and replacing characters.
Definition
USING:
lcs.private
sequences
;
IN:
lcs
:
levenshtein
( old new -- n )
[
levenshtein-initialize
]
[
levenshtein-step
]
run-lcs
last
last
;