Crate spelling

Crate spelling 

Source
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