Function txtdist::damerau_levenshtein
[−]
[src]
pub fn damerau_levenshtein(source: &str, target: &str) -> u32
Calculate the distance between two strings using the damerau levenshtein algorithm.
The Damerau–Levenshtein distance (named after Frederick J. Damerau and Vladimir I. Levenshtein) is a distance (string metric) between two strings, i.e., finite sequence of symbols, given by counting the minimum number of operations needed to transform one string into the other, where an operation is defined as an insertion, deletion, or substitution of a single character, or a transposition of two adjacent characters. wikipedia
Example
use txtdist::damerau_levenshtein; let distance = damerau_levenshtein("an act", "a cat"); assert_eq!(distance, 2)