Advertisement

06.09.2008 at 05:37AM PDT, ID: 23468789
[x]
Attachment Details

compare text strings using perl

Asked by catalini in Perl Programming Language

Tags: perl

Hi I have two text files with two indexed lists (one text string on each line, index is pipe delimited).

I would like to compare all the strings of the first file against all the strings in the second file and return their distances (ideally also the different characters).

e.g. (first file)                                                                  (second file)
1|asdasdas  fgdfgd dfgdf                                                1|asdadasda ajsjj snnnn
2|adasdasdasasdas asds  asdas                                    2|asdj 3423 dsfsdfsd
3|asdasdasda asdasd                                                     3||asndn sad333 sfsdfsdf            

Looking on CPAN I've found this very promising functions:

a) http://search.cpan.org/~spurkis/Test-Approx-0.02/lib/Test/Approx.pm   (which is based on Text::LevenshteinXS and has also a threshold feature!)
b) http://search.cpan.org/~kcivey/Text-Brew-0.02/lib/Text/Brew.pm
(which returns also the "cost" of the distance")
c) http://search.cpan.org/~davidebe/Text-WagnerFischer-0.04/WagnerFischer.pm

is there a way to use them for comparing the differences in the original text strings?

thank you very muchStart Free Trial
[+][-]06.09.2008 at 07:30AM PDT, ID: 21743442

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Tags: perl
Sign Up Now!
Solution Provided By: Adam314
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06.09.2008 at 07:49AM PDT, ID: 21743598

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.09.2008 at 08:20AM PDT, ID: 21743874

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628