Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: UDF edit distance String Comparenumber of edits
#DefineFunction LDist(s, t) ; Levenshtein Distance ; Returns the "edit distance" between two strings, ; Roughly, this is the number of edits that would be ; needed to transform one into the other. It's a ; fair estimate of similarity. m = StrLen(s) n = StrLen(t) d = ArrDimension(m + 1, n + 1) For i = 0 To m d[i, 0] = i Next i For j = 0 To n d[0, j] = j Next j For i = 1 To m For j = 1 To n If StrSub(s, i, 1) == StrSub(t, j, 1) Then cost = 0 Else cost = 1 d[i, j] = Min(d[i - 1, j] + 1, d[i, j - 1] + 1, d[i - 1, j - 1] + cost) Next j Next i Return d[m, n] #EndFunction
Article ID: W18387
Filename: Edit Distance Between Two Strings.txt
File Created: 2008:09:29:07:52:28
Last Updated: 2008:09:29:07:52:28