Hi Juman... > -----Original Message----- > From: juman [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 24, 2004 3:31 AM > To: [EMAIL PROTECTED] > Subject: Fuzzy string matching > > > I have two strings I want to compare doing some kind of fuzzy > matching? > Is there some good way to that in perl or could someone help with a > routine matching word by word and giving a percental result. > > Like > > String 1 : This is a ten characters long string is it not > String 2 : This is not so long > > String 1 compared to String 2 gives 40% (four words are the same) > String 2 compared to String 1 gives 80% (four word are the same) > > /juman >
You might try fooling around with the List::Compare module http://search.cpan.org/~jkeenan/List-Compare-0.22/Compare.pm . I've been using it recently and it's pretty nifty. It won't give you the percentages you want, but I think it could supply the raw comparison data, and then you could compute the percentages yourself. And if that's not quite right, the List::Compare page on CPAN has references to similar modules at the bottom of the page, maybe one of the other diff/compare modules might get you there. Hope that helps. -Chris -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>