line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ============================================================================ |
2
|
|
|
|
|
|
|
package Text::Phonetic::DoubleMetaphone; |
3
|
|
|
|
|
|
|
# ============================================================================ |
4
|
3
|
|
|
3
|
|
4107
|
use utf8; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
14
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
80
|
use Moo; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
13
|
|
7
|
|
|
|
|
|
|
extends qw(Text::Phonetic); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = $Text::Phonetic::VERSION; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _predicates { |
12
|
2
|
|
|
2
|
|
7
|
return 'Text::DoubleMetaphone'; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _do_compare { |
16
|
2
|
|
|
2
|
|
5
|
my ($self,$result1,$result2) = @_; |
17
|
|
|
|
|
|
|
|
18
|
2
|
100
|
|
|
|
6
|
return 50 |
19
|
|
|
|
|
|
|
if Text::Phonetic::_compare_list($result1,$result2); |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
9
|
return 0; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub _do_encode { |
25
|
8
|
|
|
8
|
|
17
|
my ($self,$string) = @_; |
26
|
|
|
|
|
|
|
|
27
|
8
|
|
|
|
|
37
|
my($code1, $code2) = Text::DoubleMetaphone::double_metaphone($string); |
28
|
8
|
|
|
|
|
27
|
return [$code1,$code2]; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=encoding utf8 |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=pod |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Text::Phonetic::DoubleMetaphone - DoubleMetaphone algorithm |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 DESCRIPTION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
The Double Metaphone search algorithm is a phonetic algorithm written by |
44
|
|
|
|
|
|
|
Lawrence Philips and is the second generation of his Metaphone algorithm. |
45
|
|
|
|
|
|
|
(Wikipedia, 2007) |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
The Result is always an array ref containing two (mostly, but not always) |
48
|
|
|
|
|
|
|
identical elements. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This module is a thin wrapper around L. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 AUTHOR |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Maroš Kollár |
55
|
|
|
|
|
|
|
CPAN ID: MAROS |
56
|
|
|
|
|
|
|
maros [at] k-1.com |
57
|
|
|
|
|
|
|
http://www.k-1.com |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 COPYRIGHT |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Text::Phonetic::DoubleMetaphone is Copyright (c) 2006,2007 Maroš. Kollár. |
62
|
|
|
|
|
|
|
All rights reserved. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This program is free software; you can redistribute |
65
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
The full text of the license can be found in the |
68
|
|
|
|
|
|
|
LICENSE file included with this module. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 SEE ALSO |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Description of the algorithm can be found at |
73
|
|
|
|
|
|
|
L |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
L |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |