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