Skip to main content

Module string_similarity

Module string_similarity 

Source
Expand description

Shared char-level Levenshtein edit distance and normalized similarity.

Used by implicit_conflict (STALE/CUPMem predicate conflict detection) and belief_revision (Kumiho relation-domain check) to compare relation/predicate strings.

Only levenshtein_distance is shared with belief_revision: its relation_similarity normalizes by byte length (not char length like normalized_similarity below) to preserve its original pre-existing behavior. Do not consolidate the two normalizations — they diverge for non-ASCII input and each caller’s threshold was tuned against its own normalization.

Functions§

levenshtein_distance
Char-level Levenshtein edit distance between two strings.
normalized_similarity
Normalized Levenshtein similarity between two strings, in [0.0, 1.0].