StringTools[Levenshtein] - compute the Levenshtein distance between two strings
|
Calling Sequence
|
|
Levenshtein( s, t )
|
|
Parameters
|
|
s
|
-
|
Maple string
|
t
|
-
|
Maple string
|
|
|
|
|
Description
|
|
•
|
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 , and computes the length of the shortest sequence of edits needed to transform one string into the other.
|
|
|
Examples
|
|
>
|
|
| (1) |
>
|
|
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
|
|
Download Help Document
Was this information helpful?