DamerauLevenshteinDistance()

Author: Titan Last Modified: nonexistent


Performs fuzzy string searching

Damerau–Levenshtein distance is the distance of two strings, counted as the different number of characters.

DamerauLevenshteinDistance(s, t)

For the functions's parameters and return value, please see it's source code.

Remarks

See at http://en.wikipedia.org/wiki/Damerau-Levenshtein_distance for more information

For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/topic28243.html

License

The functions is an open source item under the Simplified BSD license.
For details, please see titan-license.txt

Example

; #Include DamerauLevenshteinDistance.ahk
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.


tests =
( LTrim
   AHK,ahk
   He,ben
   this,tihs
   Toralf,Titan
   google,goggle
)
Loop, Parse, tests, `n
{
   StringSplit, w, A_LoopField, `,
   l .= """" . w1 . """   =>   """ . w2 . """   " . DamerauLevenshteinDistance(w1, w2) . "`n"
}
MsgBox, %l%