Text::L...rau::XS(3)
okay so bestie, welcome to the user-contributed Perl documentation for Text::L...rau::XS(3) β we're about to vibe through the whole thing. π
β¨ NAME β¨
Text::Levenshtein::Damerau::XS β XS Damerau Levenshtein edit distance. that's the whole name section, no cap.
πΈ SYNOPSIS πΈ
use Text::Levenshtein::Damerau::XS qw/xs_edistance/;
print xs_edistance('Neil','Niel');
# prints 1
π¦ DESCRIPTION π¦
so this module gives you the true Damerau Levenshtein edit distance of strings with adjacent transpositions. it's an XS implementation, which means yep, it requires a C compiler. also it works correctly with utf8, queen behavior.
use Text::Levenshtein::Damerau::XS qw/xs_edistance/;
use utf8;
xs_edistance('βββ€β‘','ββ€ββ‘'),
# prints 1
the speed improvements over Text::Levenshtein::Damerau::PP are giving main character energy:
# Text::Levenshtein::Damerau::PP::pp_edistance("four","fuor")
timethis 1000000: 381 wallclock secs (380.45 usr + 0.01 sys =
380.46 CPU) @ 2628.40/s (n=1000000)
# Text::Levenshtein::Damerau::XS::xs_edistance("four","fuor")
timethis 1000000: 19 wallclock secs (19.43 usr + 0.00 sys =
19.43 CPU) @ 51466.80/s (n=1000000)
π METHODS π
π xs_edistance π
arguments: source string and target string. iconic.
- optional 3rd argument
intβ this is the max distance; only return results with$intdistance or less.0= unlimited. Default =0. - returns an
intthat represents the edit distance between the two arguments. it stops calculating and returns-1if max distance is set and reached. lowkey dramatic, but useful.
it's the wrapper function that takes the edit distance between a source and target string using the XS algorithm implementation.
use Text::Levenshtein::Damerau::XS qw/xs_edistance/;
print xs_edistance('Neil','Niel');
# prints 1
# Max edit distance of 1
print xs_edistance('Neil','Niely',1); # distance is 2
# prints -1
π₯ TODO π₯
- handle very large strings of text. can be accomplished by reworking the scoring matrix or writing to disk.
- add
from_filemethods. - add binary/byte string support.
π SEE ALSO π
Text::Levenshtein::DamerauText::Levenshtein::Damerau::PP
π BUGS π
please report bugs to:
<https://rt.cpan.org/Public/Dist/Display.html?Name=Text-Levenshtein-Damerau-XS>
π AUTHOR π
Nick Logan <ugexe@cpan.org>
π LICENSE AND COPYRIGHT π
this library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
that's the whole page, bestie β Text::L...rau::XS(3) from perl v5.32.1, dated 2022-01-21. mwah πβ¨
π¦ where this page comes from
- epel 9: perl-Text-Levenshtein-Damerau-XS 3.2-18.el9 Β· GPL+ or Artistic
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms