logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Text::Levenshtein::Damerau::PP - Pure Perl Damerau Levenshtein edit distance.

Author

       Nick Logan <ug@skunkds.com>

Bugs

       Please report bugs to:

       <https://rt.cpan.org/Public/Dist/Display.html?Name=Text-Levenshtein-Damerau>

Description

       Returns the true Damerau Levenshtein edit distance of strings with adjacent transpositions. Pure Perl
       implementation. Works correctly with utf8.

               use Text::Levenshtein::Damerau::PP qw/pp_edistance/;
               use utf8;

               pp_edistance('ⓕⓞⓤⓡ','ⓕⓤⓞⓡ'),
               # prints 1

Methods

pp_edistance
       Arguments: source string and target string.

       •   OPTIONAL3rdargument  int  (max  distance;  only  return  results with $int distance or less). 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.

       Function  to  take  the  edit  distance between a source and target string. Contains the actual algorithm
       implementation.

               use Text::Levenshtein::Damerau::PP qw/pp_edistance/;
               print pp_edistance('Neil','Niel');
               # prints 1

               print pp_edistance('Neil','Nielx',1);
               # prints -1

Name

       Text::Levenshtein::Damerau::PP - Pure Perl Damerau Levenshtein edit distance.

See Also

       •   Text::Levenshtein::Damerau

       •   Text::Levenshtein::Damerau::XS

Synopsis

               use Text::Levenshtein::Damerau::PP qw/pp_edistance/;

               print pp_edistance('Neil','Niel');
               # prints 1

See Also