Function lib::compare

source ·
pub fn compare(str1: &str, q: &str) -> f64
Expand description

Compares two strings and returns a score based on the longest common subsequence (LCS) and normalized length comparison.

§Arguments

  • str1 - A reference to the first string.
  • q - A reference to the query string.

§Returns

  • A floating-point score representing the similarity between str1 and q.

§Examples

let score = compare("AGGTAB", "AGGTAB");
assert_eq!(score, 6.0);