[Israel.pm] approximate match (agrep like)

Yossi.Itzkovich at ecitele.com Yossi.Itzkovich at ecitele.com
Tue Apr 5 23:53:55 PDT 2005

Thanks,  that's the one.

Here are few lines from the documentation:

"String::Approx lets you match and substitute strings approximately. With
this you can emulate errors: typing errorrs, speling errors, closely
related vocabularies (colour color), genetic mutations (GAG ACT),
abbreviations (McScot, MacScot).

NOTE: String::Approx has been designed to work with strings, not with text.
In other words, when you want to compare things like text or source code,
consisting of words or tokens and phrases and sentences, or expressions and
statements, you should probably use some other tool than String::Approx,
like for example the standard UNIX diff(1) tool, or the Algorithm::Diff
module from CPAN, or if you just want the Levenshtein edit distance
(explained below), the Text::Levenshtein module from CPAN. See also
Text::WagnerFischer and Text::PhraseDistance.

The measure of approximateness is the Levenshtein edit distance. It is the
total number of "edits": insertions,

        word world


        monkey money

and substitutions

        sun fun

required to transform a string to another string. For example, to transform
"lead" into "gold", you need three edits:

        lead gead goad gold

The edit distance of "lead" and "gold" is therefore three, or 75%.

Thanks again


                      "Ephraim Dan"                                                                                                 
                      <E.Dan at F5.com>           To:      "Perl in Israel" <perl at perl.org.il>                                         
                      Sent by:                 cc:                                                                                  
                      perl-bounces at per         Subject: RE: [Israel.pm] approximate match (agrep like)                              
                      04/06/2005 07:25                                                                                              
                      Please respond                                                                                                
                      to Perl in                                                                                                    

String::Approx ?

> -----Original Message-----
> From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On
> Of Yossi.Itzkovich at ecitele.com
> Sent: Wednesday, April 06, 2005 8:39
> To: Perl in Israel
> Subject: [Israel.pm] approximate match (agrep like)
> Hi,
> Is there a way to do approximate matches like agrep ?
> Or
> Is there a way to get "scores" for matching, and thus compare which of
> several strings matches best the given text?
> Thanks
> Yossi
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl

Perl mailing list
Perl at perl.org.il

More information about the Perl mailing list