Text::...au::PP(3pm)

πŸ“¦
version 0.41 Β· 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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 $int distance 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>


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