=pod =encoding utf8 =head2 Acme::Polyglot::Levenshtein::Damerau Levenshtein and Damerau Levenshtein edit distances =for HTML =head2 Synopsis use Acme::Polyglot::Levenshtein::Damerau; print Acme::Polyglot::Levenshtein::Damerau::dld('Neil','Niel'); # prints 1 =head2 Description Returns the true Damerau Levenshtein edit distance of strings with adjacent transpositions. =head2 WARNING This is a polyglot module that works for both Perl 5 and Perl 6 -- don't use this code as inspiration for a non-polyglot codebase. =head2 Installation # Perl 5 $ cpanm https://github.com/ugexe/Acme--Polyglot--Levenshtein--Damerau.git # Perl 6 $ zef install https://github.com/ugexe/Acme--Polyglot--Levenshtein--Damerau.git =head2 Routines =over 8 =item * C Damerau Levenshtein Distance (Levenshtein Distance including transpositions) Arguments: $source, $target, $max? I<$max distance. 0 = unlimited. Default = 0> Returns: int that represents the edit distance between the two argument. Stops calculations and returns -1 if max distance is set and reached if possible. print Acme::Polyglot::Levenshtein::Damerau::dld('AABBCC','AABCBCD'); # prints 2 # Max edit distance of 1 print Acme::Polyglot::Levenshtein::Damerau::dld('AABBCC','AABCBCD',1); # distance is 2 # prints -1 =back =head3 Bugs Please report bugs to: L =head3 Author Nick Logan (ugexe) L =cut