Function rust_fuzzy_search::fuzzy_search_threshold [−][src]
pub fn fuzzy_search_threshold<'a>(
s: &'a str,
list: &'a [&str],
threshold: f32
) -> Vec<(&'a str, f32)>
Expand description
This function is similar to fuzzy_search but filters out element with a score lower than the specified one.
Arguments:
s
: the string to compare.list
: the list of strings to compare withs
.threshold
: the minimum allowed score for the elements in the result: elements with lower score will be removed.
fn test() { use rust_fuzzy_search::fuzzy_search_threshold; let s = "bulko"; let list : Vec<&str> = vec!["kolbasobulko", "sandviĉo"]; let threshold : f32 = 0.4f32; let res : Vec<(&str, f32)> = fuzzy_search_threshold(s,&list, threshold); for (_word, score) in res { println!("{:?}",score) } }