GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Text::Levenshtein::Damerau::XS(3) User Contributed Perl Documentation Text::Levenshtein::Damerau::XS(3)

Text::Levenshtein::Damerau::XS - XS Damerau Levenshtein edit distance.

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

Returns the true Damerau Levenshtein edit distance of strings with adjacent transpositions. XS implementation (requires a C compiler). Works correctly with utf8.

        use Text::Levenshtein::Damerau::XS qw/xs_edistance/;
        use utf8;
        xs_edistance('ⓕⓞⓤⓡ','ⓕⓤⓞⓡ'), 
        # prints 1

Speed improvements over Text::Levenshtein::Damerau::PP:

        # 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)

Arguments: source string and target string.

OPTIONAL 3rd argument 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.

Wrapper function to take the edit distance between a source and target string using 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

  • Handle very large strings of text. Can be accomplished by reworking the scoring matrix or writing to disk.
  • Add from_file methods.
  • Add binary/byte string support.

  • Text::Levenshtein::Damerau
  • Text::Levenshtein::Damerau::PP

Please report bugs to:

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

Nick Logan <ugexe@cpan.org>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2017-02-10 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.