?? similarity.pm
字號:
=head1 NAMEString::Similarity - calculate the similarity of two strings=head1 SYNOPSIS use String::Similarity; $similarity = similarity $string1, $string2; $similarity = similarity $string1, $string2, $limit;=head1 DESCRIPTION=over 4=cutpackage String::Similarity;require DynaLoader;$VERSION = 0.02;@ISA = qw/Exporter DynaLoader/;@EXPORT = qw(similarity);@EXPORT_OK = qw(fstrcmp);bootstrap String::Similarity $VERSION;=item $factor = similarity $string1, $string2, [$limit]The C<similarity>-function calculates the similarity index ofits two arguments. A value of C<0> means that the strings areentirely different. A value of C<1> means that the strings areidentical. Everything else lies between 0 and 1 and describes the amountof similarity between the strings.It roughly works by looking at the smallest number of edits to change onestring into the other.You can add an optional argument C<$limit> (default 0) that gives theminimum similarity the two strings must satisfy. C<similarity> stopsanalyzing the string as soon as the result drops below the given limit,in which case the result will be invalid but lower than the givenC<$limit>. You can use this to speed up the common case of searching forthe most similar string from a set by specifing the maximum similarityfound so far.=cut# out of historical reasons, I prefer "fstrcmp" as the original name.*similarity = *fstrcmp;1;=back=head1 SEE ALSO The basic algorithm is described in: "An O(ND) Difference Algorithm and its Variations", Eugene Myers, Algorithmica Vol. 1 No. 2, 1986, pp. 251-266; see especially section 4.2, which describes the variation used below. The basic algorithm was independently discovered as described in: "Algorithms for Approximate String Matching", E. Ukkonen, Information and Control Vol. 64, 1985, pp. 100-118.=head1 AUTHOR Marc Lehmann <pcg@goof.com> http://www.goof.com/pcg/marc/ (the underlying fstrcmp function was taken from gnu diffutils and modified by Peter Miller <pmiller@agso.gov.au> and Marc Lehmann <pcg@goof.com>).
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -