Function txtdist::levenshtein
[−]
[src]
pub fn levenshtein(source: &str, target: &str) -> u32
Calculate the distance between two strings using the levenshtein algorithm.
Levenshtein distance is a string metric for measuring the difference between two sequences. Informally, the Levenshtein distance between two words is the minimum number of single-character edits (i.e. insertions, deletions or substitutions) required to change one word into the other. wikipedia
Example
use txtdist::levenshtein; let distance = levenshtein("an act", "a cat"); assert_eq!(distance, 3)