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