File Coverage

blib/lib/Text/Phonetic/DoubleMetaphone.pm
Criterion Covered Total %
statement 13 13 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             # ============================================================================
2             package Text::Phonetic::DoubleMetaphone;
3             # ============================================================================
4 3     3   5414 use utf8;
  3         7  
  3         35  
5              
6 3     3   79 use Moo;
  3         6  
  3         19  
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   8 return 'Text::DoubleMetaphone';
15             }
16              
17             sub _do_compare {
18 2     2   4 my ($self,$result1,$result2) = @_;
19              
20 2 100       6 return 50
21             if Text::Phonetic::_compare_list($result1,$result2);
22              
23 1         6 return 0;
24             }
25              
26             sub _do_encode {
27 8     8   15 my ($self,$string) = @_;
28            
29 8         37 my($code1, $code2) = Text::DoubleMetaphone::double_metaphone($string);
30 8         24 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