Page 1 of 1

"Did you mean ... ?"

Posted: Tue Nov 30, 2004 7:56 am
by bytte
Hi all,

I have a website where a user can enter the name of a band. Then the name will be inserted into the MYSQL database. However, I want to avoid multiple entries as much as possible.
That's why I thought it would be good to have a page that checks for bandnames that are more or less similar. Before inserting the new bandname in the database the user would see a page " DID YOU MEAN ... ? ".

Like e.g. he would type "ACDC"
The page would display: DID YOU MEAN "AC/DC"?

I'm looking for a function, a class or a script that helps me with this.
Any suggestions?

Posted: Tue Nov 30, 2004 8:03 am
by protokol
I recommend querying the database to find all bands and then using these functions to calculate similarity:

[php_man]similar_text[/php_man]() (choose highest percentage match)
[php_man]levenshtein[/php_man]() (choose lowest 'cost')

Posted: Tue Nov 30, 2004 1:39 pm
by rehfeld
you may also find methaphone() and soundex() usefull

Posted: Thu Dec 02, 2004 11:49 am
by bytte
Thanks a lot guys!