StringTools
Levenshtein
compute the Levenshtein distance between two strings
Calling Sequence
Parameters
Description
Examples
Levenshtein( s, t )
s
-
Maple string
t
The Levenshtein( s, t ) command returns an integer measure of the distance between the two strings s and t.
This distance measure is also known as the edit distance between the strings. It counts the number of edit operations of the following kinds needed to transform the first string into the second.
There are three kinds of edit operations: insertions, deletions, and substitutions. The Levenshtein distance formula assigns each edit operation a weight equal to 1, and computes the length of the shortest sequence of edits needed to transform one string into the other.
All of the StringTools package commands treat strings as (null-terminated) sequences of 8-bit (ASCII) characters. Thus, there is no support for multibyte character encodings, such as unicode encodings.
useStringToolsinLevenshtein⁡Mathematics,Mathematischeend use
3
with⁡StringTools:
Levenshtein⁡abc,abd
1
Levenshtein⁡abc,bca
2
Levenshtein⁡brad,angelina
8
Levenshtein⁡Random⁡100,alnum,Random⁡100,alnum
96
See Also
string
StringTools[EditDistance]
StringTools[HammingDistance]
Download Help Document