Function rust_fuzzy_search::fuzzy_search_sorted
source · pub fn fuzzy_search_sorted<'a, T: AsRef<str>>(
s: &'a str,
list: &'a [T]
) -> Vec<(&'a str, f32)>
Expand description
This function is similar to fuzzy_search but sorts the result in descending order (the best matches are placed at the beginning).
Arguments:
s
: the string to compare.list
: the list of strings to compare withs
.
example:
fn test() {
use rust_fuzzy_search::fuzzy_search_sorted;
let s = "bulko";
let list : Vec<&str> = vec!["kolbasobulko", "sandviĉo"];
let res : Vec<(&str, f32)> = fuzzy_search_sorted(s,&list);
for (_word, score) in res {
println!("{:?}",score)
}
}