1Similarity(3)         User Contributed Perl Documentation        Similarity(3)
2
3
4

NAME

6       String::Similarity - calculate the similarity of two strings
7

SYNOPSIS

9        use String::Similarity;
10
11        $similarity = similarity $string1, $string2;
12        $similarity = similarity $string1, $string2, $limit;
13

DESCRIPTION

15       $factor = similarity $string1, $string2, [$limit]
16           The "similarity"-function calculates the similarity index of its
17           two arguments.  A value of 0 means that the strings are entirely
18           different. A value of 1 means that the strings are identical.
19           Everything else lies between 0 and 1 and describes the amount of
20           similarity between the strings.
21
22           It roughly works by looking at the smallest number of edits to
23           change one string into the other.
24
25           You can add an optional argument $limit (default 0) that gives the
26           minimum similarity the two strings must satisfy. "similarity" stops
27           analyzing the string as soon as the result drops below the given
28           limit, in which case the result will be invalid but lower than the
29           given $limit. You can use this to speed up the common case of
30           searching for the most similar string from a set by specifing the
31           maximum similarity found so far.
32

SEE ALSO

34        The basic algorithm is described in:
35        "An O(ND) Difference Algorithm and its Variations", Eugene Myers,
36        Algorithmica Vol. 1 No. 2, 1986, pp. 251-266;
37        see especially section 4.2, which describes the variation used below.
38
39        The basic algorithm was independently discovered as described in:
40        "Algorithms for Approximate String Matching", E. Ukkonen,
41        Information and Control Vol. 64, 1985, pp. 100-118.
42

AUTHOR

44        Marc Lehmann <schmorp@schmorp.de>
45        http://home.schmorp.de/
46
47        (the underlying fstrcmp function was taken from gnu diffutils and
48        modified by Peter Miller <pmiller@agso.gov.au> and Marc Lehmann
49        <schmorp@schmorp.de>).
50
51
52
53perl v5.38.0                      2023-07-21                     Similarity(3)
Impressum