intelligent comparison of strings in Perl

Zbigniew Koziol zkoziol-Zd07PnzKK1IAvxtiuMwx3w at public.gmane.org
Sun Mar 27 17:37:56 UTC 2005


Ilya Palagin wrote:
> Zbigniew Koziol wrote:
> ...
> 
>>
>> I suspect that there are "wiser" Perl modules around there. I would 
>> like to compare if two very similar strings are bearing in fact the 
>> same information (with some probabilty, of course, despite they are 
>> "different" strings).
> 
> 
> "The same information" depends on context.  Two strings
> contain "Toronto" and "Calgary".  Do they contain the same info?
> No - these are different cities.
> Yes - both are good as an example of Canadian city.
> 
> The module you need is String::AI
> :-)

String::AI is excellent in cases when some advanced comparison is needed ;)

In many cases it is sufficient however to use simpler methods. Their 
advantage is that it is easier to understand the code.

I found for instance that String::Similarity works very well for me.

One could try also, depanding on needs, one or more of the following:

String::Approx;
Algorithm::Diff
Text::Levenshtein
Text::WagnerFischer
Text::PhraseDistance
String::Compare

zb.


> -- 
> The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
> 


-- 
Zbigniew Koziol, SoftQuake^(tm) Open Source Business Solutions
Web Development, Linux, Web Mail Fax Voice Servers, Networking
Consultations, Innovative Technologies Tel/Fax: 1-416-530-2780
Toronto,  Canada,  http://www.softquake.ca,  info-lcEyp1+e+UdAFePFGvp55w at public.gmane.org
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list