Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Approximate matching with perl

Status
Not open for further replies.

Tiamose

Programmer
Nov 13, 2007
10
0
0
VN
Hello everybody,

I'm looking for an approximate matching approach with Perl, and I found the String::Approx package (
It's claimed to use Levenshtein edit distance (LeD) as its measure but I don't know how LeD was used in this implementation?

If I want to write my own approximate matching program using LeD, what must I do? (e.g. If 2 strings differ in less than 10% of their contents, can I say that two string are the same? or I should use another approach?)

Thank you very much,
Tiamose
 
Quoted from String::Approx

If you want to compare strings for similarity, you probably just want the Levenshtein edit distance (explained below), the Text::Levenshtein and Text::LevenshteinXS modules in CPAN. See also Text::WagnerFischer and Text::phraseDistance. (There are functions for this in String::Approx, e.g. adist(), but their results sometimes differ from the bare Levenshtein et al.)

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Hello Kevin,

Thank you, but what I want to know is how LeD was used in this package (i.e. the mechanism of this package, how does it work?).
 
download the package and open the .pm and read it.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
I think it's just using regexp's and index() to simulate LeD.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top