http://qs1969.pair.com?node_id=855527

zer has asked for the wisdom of the Perl Monks concerning the following question:

Good morning,

Is there anything available that I can compair two strings to determine how closely they match each other? I am thinking there should be a perl module for this but I can't seem to find any.

Alternately, I would likely program this myself. Perhaps there is an algorithm or some experience in the monestary that could point me in the right direction so I don't end up recreating the wheel.

I have text that was munged up by an application. I need to be able to crossreference that text with the original as the munged up text has changes i need to make to the original.

Thanks for all the help!

Replies are listed 'Best First'.
Re: Match Algorithm: How close of a match
by zwon (Abbot) on Aug 17, 2010 at 15:42 UTC
Re: Match Algorithm: How close of a match
by Fletch (Bishop) on Aug 17, 2010 at 15:43 UTC

    String::Approx? If that's not what you want the google fodder "Levenshtein distance" is probably a good starting point.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re: Match Algorithm: How close of a match
by jethro (Monsignor) on Aug 17, 2010 at 15:50 UTC
Re: Match Algorithm: How close of a match
by planetscape (Chancellor) on Aug 17, 2010 at 18:25 UTC
Re: Match Algorithm: How close of a match
by afoken (Chancellor) on Aug 17, 2010 at 20:32 UTC

    A negated hint: Don't use soundex. At least not until you know your input fits into the very narrow scope of the soundex algorithm.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re: Match Algorithm: How close of a match
by Ratazong (Monsignor) on Aug 18, 2010 at 06:51 UTC