Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Deciding which word in an array is the closest match to a given word

by eserte (Deacon)
on Sep 09, 2004 at 09:51 UTC ( [id://389607]=note: print w/replies, xml ) Need Help??


in reply to Deciding which word in an array is the closest match to a given word

Try either String::Approx or String::Similarity. The both modules are different in their approach: the former returns all matches based on an "error" or "fuzziness" parameter while the latter returns a similarity factor of two strings. Both can be tailored for your needs.
  • Comment on Re: Deciding which word in an array is the closest match to a given word

Replies are listed 'Best First'.
Re^2: Deciding which word in an array is the closest match to a given word
by Anonymous Monk on Sep 09, 2004 at 10:41 UTC
    No, that won't work because the modules are too general. "dhc15-E" and "Sony camcoder 15-e" should be a match, but something like "dhc16-E" should not match, as that will be a camcorder of a different type. But the modules you mention won't have the knowledge what the strings mean, and will consider "dhc15-E" and "dhc16-E" quite similar - as they differ by only one character.
      This looks like you need to put some custom logic in it. From your example it looks like the substring "dhc" might be substituted with "Sony camcorder". Maybe you can try to use a number of such mappings to get a canonical form. I can also imagine that dashes and spacing may differ, so strip all non-characters before comparing.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (7)
As of 2024-04-19 13:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found