Expand description
This library provides a common algorithm for calculating the Levenshtein distance
between two strings, i.e., the minimum number of single-character edits (insertions,
deletions, or substitutions) required to change one string into the other. There is
a single public function, edit_distance, which takes two string references
(&str) and a bool flag indicating whether the strings can be treated as
ASCII-only. If the flag is set to false—the safer option—the strings will operated
on as sequences of chars, i.e., 32-bit Unicode scalar values. This does involve
more allocation and probably a longer running time than the ASCII case. The return
value of edit_distance, in any event, is the Levenshtein distance as u32.
Functions§
- edit_
distance - Returns the Levenshtein distance (
u32) between two strings (&str),aandb. Theasciiflag indicates whether the strings can be treated as ASCII-only.