line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ============================================================================ |
2
|
|
|
|
|
|
|
package Text::Phonetic::Soundex; |
3
|
|
|
|
|
|
|
# ============================================================================ |
4
|
3
|
|
|
3
|
|
4025
|
use utf8; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
15
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
86
|
use Moo; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
17
|
|
7
|
|
|
|
|
|
|
extends qw(Text::Phonetic); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has 'nara'=> ( |
10
|
|
|
|
|
|
|
is => 'rw', |
11
|
|
|
|
|
|
|
documentation => q[Use the soundex variant maintained by the National Archives and Records Administration (NARA)], |
12
|
|
|
|
|
|
|
default => 0, |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has 'nocode'=> ( |
16
|
|
|
|
|
|
|
is => 'rw', |
17
|
|
|
|
|
|
|
documentation => q[Redefine the value that will be returned if the input string contains no identifiable sounds within it], |
18
|
|
|
|
|
|
|
predicate => 'has_nocode', |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = $Text::Phonetic::VERSION; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _predicates { |
24
|
2
|
|
|
2
|
|
5
|
return 'Text::Soundex'; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _do_encode { |
28
|
23
|
|
|
23
|
|
36
|
my ($self,$string) = @_; |
29
|
|
|
|
|
|
|
|
30
|
23
|
100
|
|
|
|
46
|
if ($self->has_nocode) { |
31
|
1
|
|
|
|
|
3
|
$Text::Soundex::nocode = $self->nocode; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
23
|
100
|
|
|
|
39
|
if ($self->nara) { |
35
|
1
|
|
|
|
|
5
|
return Text::Soundex::soundex_nara($string); |
36
|
|
|
|
|
|
|
} else { |
37
|
22
|
|
|
|
|
82
|
return Text::Soundex::soundex($string); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=encoding utf8 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=pod |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 NAME |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Text::Phonetic::Soundex - Soundex algorithm |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 DESCRIPTION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Soundex is a phonetic algorithm for indexing names by sound, as pronounced in |
54
|
|
|
|
|
|
|
English. Soundex is the most widely known of all phonetic algorithms. |
55
|
|
|
|
|
|
|
Improvements to Soundex are the basis for many modern phonetic algorithms. |
56
|
|
|
|
|
|
|
(Wikipedia, 2007) |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
If the parameter C is set to a true value, a variant of the soundex |
59
|
|
|
|
|
|
|
algorithm maintained by the National Archives and Records Administration |
60
|
|
|
|
|
|
|
(NARA) will be used. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
If the parameter C redefines the value that will be returned if the |
63
|
|
|
|
|
|
|
input string contains no identifiable sounds within it. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This module is a thin wrapper around L. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 AUTHOR |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Maroš Kollár |
70
|
|
|
|
|
|
|
CPAN ID: MAROS |
71
|
|
|
|
|
|
|
maros [at] k-1.com |
72
|
|
|
|
|
|
|
http://www.k-1.com |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 COPYRIGHT |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Text::Phonetic::Soundex is Copyright (c) 2006,2007 Maroš. Kollár. |
77
|
|
|
|
|
|
|
All rights reserved. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This program is free software; you can redistribute |
80
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
The full text of the license can be found in the |
83
|
|
|
|
|
|
|
LICENSE file included with this module. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 SEE ALSO |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Description of the algorithm can be found at |
88
|
|
|
|
|
|
|
L |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
L |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |