DamerauLevenshteinDistance()

作者: Titan 最近更新时间: nonexistent


Performs fuzzy string searching

Damerau朙evenshtein distance is the distance of two strings, counted as the different number of characters.

DamerauLevenshteinDistance(s, t)

关于函数的参数和返回值, 请参阅其源码.

备注

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

关于此函数(集)的更新细节和注意事项, 请参见 AutoHotkey 论坛: http://www.autohotkey.com/forum/topic28243.html

许可

此函数(集)是基于 Simplified BSD 许可的开源项目. 想了解许可详情, 请参见 titan-license.txt

示例

; #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%