File Coverage

blib/lib/Text/Phonetic/Metaphone.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 13 13 100.0


line stmt bran cond sub pod time code
1             # ============================================================================
2             package Text::Phonetic::Metaphone;
3             # ============================================================================
4 3     3   4233 use utf8;
  3         11  
  3         22  
5              
6 3     3   96 use Moo;
  3         8  
  3         19  
7             extends qw(Text::Phonetic);
8              
9             has 'max_length'=> (
10             is => 'rw',
11             isa => sub {
12             die 'max_length must be an int' unless shift =~ /\d/
13             },
14             documentation => q[Limit the length of the encoded string],
15             default => 0,
16             );
17              
18             __PACKAGE__->meta->make_immutable;
19              
20             our $VERSION = $Text::Phonetic::VERSION;
21              
22             sub _predicates {
23 2     2   8 return 'Text::Metaphone';
24             }
25              
26             sub _do_encode {
27 9     9   22 my ($self,$string) = @_;
28            
29 9         146 return Text::Metaphone::Metaphone($string,$self->max_length);
30             }
31              
32             1;
33              
34             =encoding utf8
35              
36             =pod
37              
38             =head1 NAME
39              
40             Text::Phonetic::Metaphone - Metaphone algorithm
41              
42             =head1 DESCRIPTION
43              
44             Metaphone was developed by Lawrence Philips as a response to deficiencies in
45             the Soundex algorithm. It is more accurate than Soundex because it uses a
46             larger set of rules for English pronunciation. (Wikipedia, 2007)
47              
48             This module is a thin wrapper around L.
49              
50             The parameter C can be set to limit the length of the encoded
51             string.
52              
53             =head1 AUTHOR
54              
55             Maroš Kollár
56             CPAN ID: MAROS
57             maros [at] k-1.com
58             http://www.k-1.com
59              
60             =head1 COPYRIGHT
61              
62             Text::Phonetic::Metaphone is Copyright (c) 2006,2007 Maroš. Kollár.
63             All rights reserved.
64              
65             This program is free software; you can redistribute
66             it and/or modify it under the same terms as Perl itself.
67              
68             The full text of the license can be found in the
69             LICENSE file included with this module.
70              
71             =head1 SEE ALSO
72              
73             Description of the algorithm can be found at
74             L
75              
76             L
77              
78             =cut