Skip to main content

Module distance

Module distance 

Source
Expand description

String distance/similarity calculation utilities

This module provides wrappers around strsim algorithms for fuzzy matching. It is the measurement layer under the repair stage: every rename and enum-value correction is scored here, and only candidates at or above FuzzyOptions::min_similarity are applied.

§Choosing an algorithm

AlgorithmCharacteristicsBest for
Algorithm::JaroWinkler (default)Prefix-weighted, handles transpositionsGeneral LLM typos
Algorithm::LevenshteinUniform insert/delete/substitute costEdit-distance semantics
Algorithm::DamerauLevenshteinLevenshtein + transpositionsTransposition-heavy typos

All similarities are normalized to 0.0..=1.0 (1.0 = identical), so the same threshold works across algorithms.

Structs§

Match
Match result with similarity score

Enums§

Algorithm
Algorithm for similarity calculation

Functions§

find_all_matches
Find all matches above the minimum similarity threshold
find_closest
Find the closest match from a list of candidates
similarity
Calculate similarity between two strings