Function lev_distance::find_best_match_for_name[][src]

pub fn find_best_match_for_name<T>(
    iter_names: impl Iterator<Item = T> + Clone,
    lookup: &str,
    dist: Option<usize>
) -> Option<String> where
    T: AsRef<str>, 
Expand description

Finds the best match for a given word in the given iterator.

As a loose rule to avoid the obviously incorrect suggestions, it takes an optional limit for the maximum allowable edit distance, which defaults to one-third of the given word.

Besides Levenshtein, we use case insensitive comparison to improve accuracy on an edge case with a lower(upper)case letters mismatch.