1Levenshtein(3) User Contributed Perl Documentation Levenshtein(3)
2
3
4
6 Text::Levenshtein - An implementation of the Levenshtein edit distance
7
9 use Text::Levenshtein qw(distance);
10
11 print distance("foo","four");
12 # prints "2"
13
14 print fastdistance("foo","four");
15 # prints "2" faster
16
17 my @words=("four","foo","bar");
18 my @distances=distance("foo",@words);
19
20 print "@distances";
21 # prints "2 0 3"
22
24 This module implements the Levenshtein edit distance. The Levenshtein
25 edit distance is a measure of the degree of proximity between two
26 strings. This distance is the number of substitutions, deletions or
27 insertions ("edits") needed to transform one string into the other one
28 (and vice versa). When two strings have distance 0, they are the same.
29 A good point to start is: <http://www.merriampark.com/ld.htm>
30
31 &fastdistance can be called with two scalars and is faster in most
32 cases.
33
34 See also Text::LevenshteinXS on CPAN if you do not require a perl-only
35 implementation. It is extremely faster in nearly all cases.
36
37 See also Text::WagnerFischer on CPAN for a configurable edit distance,
38 i.e. for configurable costs (weights) for the edits.
39
41 Copyright 2002 Dree Mistrut <dree@friul.it>
42
43 This package is free software and is provided "as is" without express
44 or implied warranty. You can redistribute it and/or modify it under
45 the same terms as Perl itself.
46
47
48
49perl v5.12.0 2004-03-06 Levenshtein(3)