Skip to content

damerauLevenshtein

damerauLevenshtein(a, b): number

Compute the Damerau-Levenshtein distance between two strings.

Like Levenshtein, but also considers transpositions of two adjacent characters as a single edit.

Compares the Unicode code points of the strings as given: case, whitespace and Unicode normalization (NFC vs NFD) are not adjusted. Takes time proportional to the product of the two lengths: about 0.4 s for two 10,000-character strings with the native addon.

Parameter Type
a string
b string

number