Skip to content

Commit

Permalink
Document distDamerau a little better.
Browse files Browse the repository at this point in the history
  • Loading branch information
c-blake committed Jul 19, 2024
1 parent 8170dcc commit 60cb157
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cligen/textUt.nim
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ type C = int16 ##Type for edit cost values & totals
const mxC = C.high
proc distDamerau*[T](a, b: openArray[T], maxDist=mxC,
idC=C(1), subC=C(1), xpoC=C(1), dI: var seq[C]): C =
## True Damerau(1964) distance with unrestricted transpositions.
## True Damerau (1964) distance with unrestricted transpositions (not OSA) and
## user cost scales for ins-del, substitute, transposition. For details see:
## https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance
var n = a.len #ensure 2nd arg shorter (m < n)
var m = b.len #XXX Ukkonen/Berghel or even faster Myers/Hyyro?
if abs(n - m) * int(idC) >= int(maxDist):
Expand Down

0 comments on commit 60cb157

Please sign in to comment.