# Function strsim::generic_damerau_levenshtein

source · [−]

    pub fn generic_damerau_levenshtein<Elem>(
        a_elems: &[Elem],
        b_elems: &[Elem]
    ) -> usize where
        Elem: Eq + Hash + Clone,

Expand description

Like optimal string alignment, but substrings can be edited an unlimited number of times, and the triangle inequality holds.

    use strsim::generic_damerau_levenshtein;

    assert_eq!(2, generic_damerau_levenshtein(&[1,2], &[2,3,1]));