levenshtein_similarity
Normalized levenshtein_distance between a and b, in [0, 1].
1 means identical, 0 means completely dissimilar relative to the longer string’s length.
A convenience wrapper for scoring or ranking use cases.
Import
Section titled “Import”Cargo feature string (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
a | &str | The first string. |
b | &str | The second string. |
case_sensitive | bool | Whether the comparison is case-sensitive. |
Returns
Section titled “Returns”f64 — A similarity score between 0 and 1; 1 when both strings are empty.
