ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/String-Similarity/README
Revision: 1.1
Committed: Sat Jun 25 09:55:53 2005 UTC (18 years, 11 months ago) by root
Branch: MAIN
CVS Tags: rel-1_04, HEAD
Log Message:
*** empty log message ***

File Contents

# Content
1 NAME
2 String::Similarity - calculate the similarity of two strings
3
4 SYNOPSIS
5 use String::Similarity;
6
7 $similarity = similarity $string1, $string2;
8 $similarity = similarity $string1, $string2, $limit;
9
10 DESCRIPTION
11 $factor = similarity $string1, $string2, [$limit]
12 The "similarity"-function calculates the similarity index of its two
13 arguments. A value of 0 means that the strings are entirely
14 different. A value of 1 means that the strings are identical.
15 Everything else lies between 0 and 1 and describes the amount of
16 similarity between the strings.
17
18 It roughly works by looking at the smallest number of edits to
19 change one string into the other.
20
21 You can add an optional argument $limit (default 0) that gives the
22 minimum similarity the two strings must satisfy. "similarity" stops
23 analyzing the string as soon as the result drops below the given
24 limit, in which case the result will be invalid but lower than the
25 given $limit. You can use this to speed up the common case of
26 searching for the most similar string from a set by specifing the
27 maximum similarity found so far.
28
29 SEE ALSO
30 The basic algorithm is described in:
31 "An O(ND) Difference Algorithm and its Variations", Eugene Myers,
32 Algorithmica Vol. 1 No. 2, 1986, pp. 251-266;
33 see especially section 4.2, which describes the variation used below.
34
35 The basic algorithm was independently discovered as described in:
36 "Algorithms for Approximate String Matching", E. Ukkonen,
37 Information and Control Vol. 64, 1985, pp. 100-118.
38
39 AUTHOR
40 Marc Lehmann <schmorp@schmorp.de>
41 http://home.schmorp.de/
42
43 (the underlying fstrcmp function was taken from gnu diffutils and
44 modified by Peter Miller <pmiller@agso.gov.au> and Marc Lehmann
45 <schmorp@schmorp.de>).
46