Text::...au::PP(3pm)
π NAME π
Text::Levenshtein::Damerau::PP β bestie, it's the Pure Perl Damerau Levenshtein edit distance. That's it, that's the whole vibe. π
β¨ SYNOPSIS β¨
use Text::Levenshtein::Damerau::PP qw/pp_edistance/;
print pp_edistance('Neil','Niel');
# prints 1
okay so lowkey iconic that 'Neil' and 'Niel' are one whole transposition apart and this module knows. π
πΈ DESCRIPTION πΈ
It returns the true Damerau Levenshtein edit distance of strings, adjacent transpositions included. It's the Pure Perl implementation, and it works correctly with utf8. No cap. π¦
use Text::Levenshtein::Damerau::PP qw/pp_edistance/;
use utf8;
pp_edistance('βββ€β‘','ββ€ββ‘'),
# prints 1
she handles the pretty circled unicode letters too, we love that for her π
π METHODS π
π pp_edistance
The way this one is the whole function. Arguments: a source string and a target string. π«Ά
- OPTIONAL 3rd argument int (max distance; only return results with
$intdistance or less).0= unlimited. Default =0.
Returns: an int that represents the edit distance between the two argument. It 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. main character energy fr fr. β¨
use Text::Levenshtein::Damerau::PP qw/pp_edistance/;
print pp_edistance('Neil','Niel');
# prints 1
print pp_edistance('Neil','Nielx',1);
# prints -1
see how that second one bails out with -1? that's the max-distance cap doing its thing, not a bug, bestie π
π₯ SEE ALSO π₯
- Text::Levenshtein::Damerau
- Text::Levenshtein::Damerau::XS
(go look at the XS one if you want the speed girlies, iykyk π)
π BUGS π
Please report bugs to:
<https://rt.cpan.org/Public/Dist/Display.html?Name=Text-Levenshtein-Damerau>
don't be shy, the maintainers want to hear it π
π AUTHOR π
Nick Logan <ug@skunkds.com>
π LICENSE AND COPYRIGHT π
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. periodt. π
mwah, that's the whole page β running under perl v5.36.0, dated 2022-10-13, and yes it's the Text::...au::PP page in the User Contributed Perl Documentation. stan a tiny pure-perl module, no cap π§π
π¦ where this page comes from
- ubuntu noble: libtext-levenshtein-damerau-perl 0.41-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtext-levenshtein-damerau-perl 0.41-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtext-levenshtein-damerau-perl 0.41-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms