Source Edit

This module implements an algorithm to compute the edit distance between two Unicode strings.

Imports

unicode

Procs

  1. proc editDistance(a, b: string): int {.noSideEffect, ...raises: [], tags: [],
  2. forbids: [].}

Returns the unicode-rune edit distance between a and b.

This uses the Levenshtein distance algorithm with only a linear memory overhead.

Example:

  1. static: doAssert editdistance("Kitten", "Bitten") == 1

Source Edit

  1. proc editDistanceAscii(a, b: string): int {.noSideEffect, ...raises: [], tags: [],
  2. forbids: [].}

Returns the edit distance between a and b.

This uses the Levenshtein distance algorithm with only a linear memory overhead.

Example:

  1. static: doAssert editDistanceAscii("Kitten", "Bitten") == 1

Source Edit