StringTools[EditDistance] - compute the edit distance between two strings
|
Calling Sequence
|
|
EditDistance( s, t )
|
|
Parameters
|
|
s
|
-
|
Maple string
|
t
|
-
|
Maple string
|
|
|
|
|
Description
|
|
•
|
The EditDistance(s,t) command returns an integer measure of the distance between the two strings s and t.
|
•
|
The edit distance between two strings s and t, is defined to be the difference between the sum of their lengths and twice the length of the longest common subsequence of s and t. If strings s and t have respective lengths m and n, then the edit distance is defined to be . It is related to the Levenshtein metric, which is sometimes also called the edit distance.
|
|
|
Examples
|
|
>
|
|
| (1) |
>
|
|
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
Since it is a metric, the edit distance satisfies the triangle inequality.
>
|
|
>
|
|
>
|
|
>
|
|
| (6) |
>
|
|
| (7) |
|
|
Download Help Document
Was this information helpful?