-
-
27 Jan 2016 21:08:46 UTC
- Distribution: Text-Levenshtein-XS
- Module version: 0.503
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (0)
- Testers (2320 / 0 / 0)
- Kwalitee
Bus factor: 0- 94.74% Coverage
- License: perl_5
- Perl: v5.8.0
- Activity
24 month- Tools
- Download (22.92KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- NAME
- VERSION
- SYNOPSIS
- DESCRIPTION
- METHODS
- NOTES
- SEE ALSO
- REPOSITORY
- BUGS
- AUTHOR
- COPYRIGHT AND LICENSE
NAME
Text::Levenshtein::XS - Calculate edit distance based on insertion, deletion, and substitution
VERSION
version 0.503
SYNOPSIS
use Text::Levenshtein::XS qw/distance/; print distance('Neil','Niel'); # prints 2
DESCRIPTION
Returns the number of edits (insert,delete,substitute) required to turn the source string into the target string. XS implementation (requires a C compiler). Works correctly with utf8.
use Text::Levenshtein::XS qw/distance/; use utf8; distance('ⓕⓞⓤⓡ','ⓕⓤⓞⓡ'), # prints 2
METHODS
distance
- Arguments: $source_text, $target_text, (optional) $max_distance
- Return Value: Int $edit_distance || undef (if max_distance is exceeded)
Returns: int that represents the edit distance between the two argument, or undef if $max_distance threshold is exceeded.
Takes the edit distance between a source and target string using XS 2 vector implementation.
use Text::Levenshtein::XS qw/distance/; print distance('Neil','Niel'); # prints 2
Stops calculations and returns undef if $max_distance is set, non-zero (0 = no limit), and the algorithm has determined the final distance will be greater than $max_distance.
my $distance = distance('Neil','Niel',1); print (defined $distance) ? $distance : "Exceeded max distance"; # prints "Exceeded max distance"
NOTES
Drop in replacement for Text::LevenshteinXS
SEE ALSO
REPOSITORY
https://github.com/ugexe/Text--Levenshtein--XS
BUGS
Please report bugs to:
https://github.com/ugexe/Text--Levenshtein--XS/issues
AUTHOR
ugexe <ugexe@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Nick Logan.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install Text::Levenshtein::XS, copy and paste the appropriate command in to your terminal.
cpanm Text::Levenshtein::XS
perl -MCPAN -e shell install Text::Levenshtein::XS
For more information on module installation, please visit the detailed CPAN module installation guide.