Expand description
use spelling::spellcheck;
let dictionary_string = include_str!("words.txt"); // newline separated
spellcheck(dictionary_string.split("\n"), "restaraunt", 3);
This uses the Levenshtein distance as the heuristic for distance.
Functionsยง
- levenshtein_
distance - Computes the Levenshtein distance, the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one string into the other.
- levenshtein_
distance_ with_ max - An optimized version of the Levenshtein distance that stops early if the distance exceeds max_distance This is useful for spellchecking where we only care about suggestions within a certain distance, and can save time by not computing the full distance When the distance exceeds max_distance, we will return an arbitrary number greater than max_distance.
- spell_
check_ rayon - spellcheck