Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Comparing Approximate Items

by tall_man (Parson)
on Jan 08, 2003 at 17:12 UTC ( [id://225299]=note: print w/replies, xml ) Need Help??


in reply to Comparing Approximate Items

It sounds like you need String::Approx, using amatch with a modified edit distance of 3. Tie::Hash::Approx might be even better except that it doesn't allow you to modify the edit distance, and the default distance of 10% is too close for what you are asking for. Perhaps a hand-hacked version of it with a different compare function would do?

Modified to include CPAN refs and an additional comment.

Replies are listed 'Best First'.
Re: Re: Comparing Approximate Items
by artist (Parson) on Jan 08, 2003 at 17:26 UTC
    Hi,
    For I just have one correction Sets A and B doesn't contain the same number of strings
    Should read : Sets A and B may not contain the same number of strings

    I use use Algorithm::Diff and that works approximately ok for my match-purpose.

    Aritst

      It's not obvious to me how Algorithm::Diff can be used to compute edit distances. Do you call diff() and then count up the number of insertions and deletions in the result?

      Suppose you have several equidistant matches from a given element in A to several elements in B. Do you have to pick one of them such that the overall number of pairings is maximized? It might be an NP-complete problem.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://225299]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-25 22:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found