| 1 | # ============================================================================ | ||||||||||
| 2 | package Text::Phonetic::Soundex; | ||||||||||
| 3 | # ============================================================================ | ||||||||||
| 4 | 3 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 3 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 3 | extends qw(Text::Phonetic); | |||||||||
| 8 | |||||||||||
| 9 | 3 | 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 | 3 | 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 | 3 | our $VERSION = $Text::Phonetic::VERSION; | |||||||||
| 22 | |||||||||||
| 23 | 2 | ▶ | sub _predicates { | ||||||||
|
Subroutine
_predicates: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 2 | return 'Text::Soundex'; | |||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 23 | ▶ | sub _do_encode { | ||||||||
|
Subroutine
_do_encode: called CC=3 SCAR=11.0
| |||||||||||
| 28 | 23 | my ($self,$string) = @_; | |||||||||
| 29 | |||||||||||
| 30 | 23 | ▶ | if ($self->has_nocode) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 1 | $Text::Soundex::nocode = $self->nocode; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 23 | ▶ | if ($self->nara) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 1 | return Text::Soundex::soundex_nara($string); | |||||||||
| 36 | } else { | ||||||||||
| 37 | 22 | return Text::Soundex::soundex($string); | |||||||||
| 38 | } | ||||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 3 | 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<nara> 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<nocode> 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<Text::Soundex>. | ||||||||||
| 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<http://en.wikipedia.org/wiki/Soundex> | ||||||||||
| 89 | |||||||||||
| 90 | L<Text::Soundex> | ||||||||||
| 91 | |||||||||||
| 92 | =cut | ||||||||||