fuzzy_match

Function fuzzy_match 

Source
pub fn fuzzy_match<S1: AsRef<str>, S2: AsRef<str>>(str1: S1, str2: S2) -> bool
Expand description

Performs a fuzzy match between two strings using the default threshold.

This function uses the partial_ratio similarity score and the default threshold (DEFAULT_FUZZ_THRESHOLD) to determine if the two strings are similar enough. If the similarity score exceeds the default threshold, the strings are considered a match.

§Parameters

  • str1: The first string to compare, implementing AsRef<str>.
  • str2: The second string to compare, implementing AsRef<str>.

§Returns

  • true if the similarity score exceeds the default threshold.
  • false otherwise.

§Example

use lib2fas::fuzzy::fuzzy_match;

let is_match = fuzzy_match("hello world", "world");
if is_match {
    println!("The strings are similar!");
} else {
    println!("The strings are not similar.");
}