On this page
std/editdistance
Source EditThis module implements an algorithm to compute the edit distance between two Unicode strings.
Imports
Procs
-
proc editDistance(a, b: string): int {.noSideEffect, ...raises: [], tags: [], forbids: [].}
-
Returns the unicode-rune edit distance between
a
andb
.This uses the Levenshtein distance algorithm with only a linear memory overhead.
Example:
Source Editstatic: doAssert editdistance("Kitten", "Bitten") == 1
-
proc editDistanceAscii(a, b: string): int {.noSideEffect, ...raises: [], tags: [], forbids: [].}
-
Returns the edit distance between
a
andb
.This uses the Levenshtein distance algorithm with only a linear memory overhead.
Example:
Source Editstatic: doAssert editDistanceAscii("Kitten", "Bitten") == 1
© 2006–2024 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/editdistance.html