Function similar::text::get_close_matches [−][src]
pub fn get_close_matches<'a>(
word: &str,
possibilities: &[&'a str],
n: usize,
cutoff: f32
) -> Vec<&'a str>
Use the text differ to find n
close matches.
cutoff
defines the threshold which needs to be reached for a word
to be considered similar. See TextDiff::ratio
for more information.
let matches = get_close_matches( "appel", &["ape", "apple", "peach", "puppy"][..], 3, 0.6 ); assert_eq!(matches, vec!["apple", "ape"]);