Skip to main content

compare_pair

Function compare_pair 

Source
pub fn compare_pair(
    source_code_a: &str,
    source_code_b: &str,
    cross_language: bool,
    threshold: f64,
) -> Option<CloneMatch>
Expand description

Compare two source code snippets and return a CloneMatch if they are similar enough, or None otherwise.

  • cross_language: structural-only path — immediately returns a StructuralOnly match with similarity 1.0.
  • Otherwise: raw Jaccard ≥ 0.95 → Type1; normalized Jaccard ≥ threshold → Type2; below threshold → None.
  • The source and target fields of the returned match are left empty; the caller is expected to fill them in.