Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,23 @@
|
|||
//Code By Neurox66
|
||||
function Levenshtein pString1 pString2
|
||||
put 0 into tPosChar1
|
||||
repeat for each char tChar1 in pString1
|
||||
add 1 to tPosChar1
|
||||
put tPosChar1 into tDistance[tPosChar1][0]
|
||||
put 0 into tPosChar2
|
||||
repeat for each char tChar2 in pString2
|
||||
add 1 to tPosChar2
|
||||
put tPosChar2 into tDistance[0][tPosChar2]
|
||||
put 1 into tCost
|
||||
if tChar1 = tChar2 then
|
||||
put 0 into tCost
|
||||
end if
|
||||
put min((tDistance[tPosChar1-1][tPosChar2] + 1),(tDistance[tPosChar1][tPosChar2-1] + 1),(tDistance[tPosChar1-1][tPosChar2-1] + tCost)) into tDistance[tPosChar1][tPosChar2]
|
||||
end repeat
|
||||
end repeat
|
||||
return tDistance[tPosChar1][tPosChar2]
|
||||
end Levenshtein
|
||||
|
||||
|
||||
put Levenshtein("kitten","sitting")
|
||||
put Levenshtein("rosettacode","raisethysword")
|
||||
Loading…
Add table
Add a link
Reference in a new issue