Text::Phonetic::DoubleMetaphone - DoubleMetaphone algorithm


Text-Phonetic documentation Contained in the Text-Phonetic distribution.

Index


Code Index:

NAME

Top

Text::Phonetic::DoubleMetaphone - DoubleMetaphone algorithm

DESCRIPTION

Top

The Double Metaphone search algorithm is a phonetic algorithm written by Lawrence Philips and is the second generation of his Metaphone algorithm. (Wikipedia, 2007)

The Result is always an array ref containing two (mostly, but not always) identical elements.

This module is a thin wrapper arround Text::DoubleMetaphone.

AUTHOR

Top

    Maroš Kollár
    CPAN ID: MAROS
    maros [at] k-1.com
    http://www.k-1.com

COPYRIGHT

Top

SEE ALSO

Top

Description of the algorithm can be found at http://en.wikipedia.org/wiki/Double_Metaphone

Text::DoubleMetaphone


Text-Phonetic documentation Contained in the Text-Phonetic distribution.

# ============================================================================
package Text::Phonetic::DoubleMetaphone;
# ============================================================================
use utf8;

use Moose;
extends qw(Text::Phonetic);

__PACKAGE__->meta->make_immutable;

our $VERSION = $Text::Phonetic::VERSION;

sub _predicates {
    return 'Text::DoubleMetaphone';
}

sub _do_compare {
    my ($self,$result1,$result2) = @_;

    return 50 
       if Text::Phonetic::_compare_list($result1,$result2);	

    return 0;
}

sub _do_encode {
    my ($self,$string) = @_;
    
    my($code1, $code2) = Text::DoubleMetaphone::double_metaphone($string);
    return [$code1,$code2];
}

1;