Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Cluster a big bunch of strings

by hawtin (Prior)
on Mar 31, 2009 at 12:55 UTC ( #754410=note: print w/ replies, xml ) Need Help??


in reply to Cluster a big bunch of strings

I had a similar issue when I set up a web site that consolidates music charts from around the world. In my case I wanted to match names of artists and titles of songs, the source data tended to have challenges ranging from the simple ("Beatles" v "The Beatles" and "Gary Crosby" v "Gary Crosby and his Orchestra") to the really quite complex ("Paul McCartney" v "Wings").

I have used a modified Levenshtein distance algorithm on strings that have been Soundex-ed, which was then tuned so that processing the 279,524 entries currently takes 4 or so hours on a reasonable machine.

You have to match the processing you are doing with the types of mistakes in your data. For names this will be spelling mistakes (so when matching names you must preprocess them with something like Soundex). For titles I would guess that, like my song titles, the words tend to be spelt correctly but you get them in different orders, you get issues like:

  • "Que sera sera (Whatever will be will be)" v "Whatever will be will be (Que sera sera)"
  • "Do What U Gotta Do" v "Do What You've Got to Do"
  • "Maybe It's Because" v "Maybe its because"
  • "Aint it Funny" v "Ain't it funny (Pettibone Remix)"
  • "Jazz-A-Samba... Part 1" v "Jazz A Samba"
  • "Would'ja Mind?" v "Would you Mind"

So you want to process the names to spot the type of transcription error you have got. For example I take the distinctive words independent of order and use that as a first pass check, if you can quickly spot items that don't match then the tiny minority that could match can have distances calculated with a more comprehensive algorithm. My guess would be that, as with my data, the matches are few and far between.

Finally, in my case, there are always things that just don't match and have to be processed by hand. Don't be surprised to find that, for some of the dumb things people do, you just have to fix them manually. We have a continual effort to detect matches and fix them in our source data


Comment on Re: Cluster a big bunch of strings

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2014-12-21 02:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (101 votes), past polls