Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
t
 
 
xt
 
 
 
 
 
 
 
 
 
 

Text::Levenshtein::Damerau

Levenshtein and Damerau Levenshtein edit distances

Synopsis

use Text::Levenshtein::Damerau;

say dld('Neil','Niel'); # damerau levenstein distance
# prints 1

say ld('Neil','Niel'); # levenshtein distance
prints 2

Description

Returns the true Levenshtein or Damerau Levenshtein edit distance of strings with adjacent transpositions.

Routines

  • dld

    Damerau Levenshtein Distance (Levenshtein Distance including transpositions)

    Arguments: $source, $target, $max?

    $max distance. 0 = unlimited. Default = 0

    Returns: int that represents the edit distance between the two argument. Stops calculations and returns Int if max distance is set and reached if possible.

    use Text::Levenshtein::Damerau;
    say dld('AABBCC','AABCBCD');
    # prints 2
    
    # Max edit distance of 1
    say dld('AABBCC','AABCBCD',1); # distance is 2
    # prints Int
  • ld

    Levenshtein Distance (no transpositions)

    Arguments: $source, $target, $max?

    $max distance. 0 = unlimited. Default = 0

    Returns: Int that represents edit distance between the two argument. Stops calculations and returns Int if max distance is set and reached if possible.

    use Text::Levenshtein::Damerau;
    say ld('AABBCC','AABCBCD');
    # prints 3
    
    # Max edit distance of 1
    # Uses regular Levenshtein distance (no transpositions)
    say ld('AABBCC','AABCBCD',1); # distance is 3
    # prints Int

Bugs

Please report bugs to:

https://github.com/ugexe/Perl6-Text--Levenshtein--Damerau/issues

Author

Nick Logan nlogan@gmail.com

About

Damerau Levenshtein edit distance in Perl6

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages

  • Other 100.0%