After finishing two cs classes, I started working on a personal Java project. I am writing a program that will browse the music collection and try to set the "Composer" tag by looking at the file name and meta tags. I compare them to a composition list that I created as a simple text file. My question is this:
What is a good method of comparing two strings to try to find the best match? For example, in my case, suppose I have a file called "Pulenc - Gloria in excelsis Deo.flac". On my list of composers, I have Pulenc, Francis. I want to be able to read "Pulenc" and see that it is very close to "Poulenc", so that I can set the composer tag correctly. A friend suggested that I study the Cosine Distance (which I had never heard of before), and another recommended the Levenshtein distance. Do they have a good approach or are there other methods that may work better?
source share