| 1 | # ============================================================================ | ||||||||||
| 2 | package Text::Phonetic::DoubleMetaphone; | ||||||||||
| 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 | our $VERSION = $Text::Phonetic::VERSION; | |||||||||
| 10 | |||||||||||
| 11 | 2 | ▶ | sub _predicates { | ||||||||
|
Subroutine
_predicates: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 2 | return 'Text::DoubleMetaphone'; | |||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 2 | ▶ | sub _do_compare { | ||||||||
|
Subroutine
_do_compare: called CC=2 SCAR=6.9
| |||||||||||
| 16 | 2 | my ($self,$result1,$result2) = @_; | |||||||||
| 17 | |||||||||||
| 18 | 2 | ▶ | return 50 | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | if Text::Phonetic::_compare_list($result1,$result2); | ||||||||||
| 20 | |||||||||||
| 21 | 1 | return 0; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 8 | ▶ | sub _do_encode { | ||||||||
|
Subroutine
_do_encode: called CC=1 SCAR=0.0
| |||||||||||
| 25 | 8 | my ($self,$string) = @_; | |||||||||
| 26 | |||||||||||
| 27 | 8 | my($code1, $code2) = Text::DoubleMetaphone::double_metaphone($string); | |||||||||
| 28 | 8 | return [$code1,$code2]; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 3 | 1; | |||||||||
| 32 | |||||||||||
| 33 | =encoding utf8 | ||||||||||
| 34 | |||||||||||
| 35 | =pod | ||||||||||
| 36 | |||||||||||
| 37 | =head1 NAME | ||||||||||
| 38 | |||||||||||
| 39 | Text::Phonetic::DoubleMetaphone - DoubleMetaphone algorithm | ||||||||||
| 40 | |||||||||||
| 41 | =head1 DESCRIPTION | ||||||||||
| 42 | |||||||||||
| 43 | The Double Metaphone search algorithm is a phonetic algorithm written by | ||||||||||
| 44 | Lawrence Philips and is the second generation of his Metaphone algorithm. | ||||||||||
| 45 | (Wikipedia, 2007) | ||||||||||
| 46 | |||||||||||
| 47 | The Result is always an array ref containing two (mostly, but not always) | ||||||||||
| 48 | identical elements. | ||||||||||
| 49 | |||||||||||
| 50 | This module is a thin wrapper around L<Text::DoubleMetaphone>. | ||||||||||
| 51 | |||||||||||
| 52 | =head1 AUTHOR | ||||||||||
| 53 | |||||||||||
| 54 | Maroš Kollár | ||||||||||
| 55 | CPAN ID: MAROS | ||||||||||
| 56 | maros [at] k-1.com | ||||||||||
| 57 | http://www.k-1.com | ||||||||||
| 58 | |||||||||||
| 59 | =head1 COPYRIGHT | ||||||||||
| 60 | |||||||||||
| 61 | Text::Phonetic::DoubleMetaphone is Copyright (c) 2006,2007 Maroš. Kollár. | ||||||||||
| 62 | All rights reserved. | ||||||||||
| 63 | |||||||||||
| 64 | This program is free software; you can redistribute | ||||||||||
| 65 | it and/or modify it under the same terms as Perl itself. | ||||||||||
| 66 | |||||||||||
| 67 | The full text of the license can be found in the | ||||||||||
| 68 | LICENSE file included with this module. | ||||||||||
| 69 | |||||||||||
| 70 | =head1 SEE ALSO | ||||||||||
| 71 | |||||||||||
| 72 | Description of the algorithm can be found at | ||||||||||
| 73 | L<http://en.wikipedia.org/wiki/Double_Metaphone> | ||||||||||
| 74 | |||||||||||
| 75 | L<Text::DoubleMetaphone> | ||||||||||
| 76 | |||||||||||
| 77 | =cut | ||||||||||