Hello,
I would like to optimize the search function on my website and implement a sort of correcting function for misspelled words.
If the string doesn't match any word in my mysql field, I begin to search "select * from mytable where field like '%_tring%'" and then s_ring, st_ing, etc... Then I search for %tring, s%ring, st%ing, etc...
Is this a good way to procede ? How can I make my script better ?
I've searched for tutorials or scripts-examples for functions like this with no results, if you know anything about this, I would really appreciate an answer!
correcting misspelled words in a search input
Moderator: General Moderators
WordNet
If you want a real good spell check you'll need a db containing words etc to do this efficiently.
You'll find an open source(? maybe just free) here :http://wordnet.princeton.edu/ but the MySQL conversion is done by another org : http://www.androidtech.com/html/wordnet-mysql-20.php
This way you can check and suggest like the way Google does.
You'll find an open source(? maybe just free) here :http://wordnet.princeton.edu/ but the MySQL conversion is done by another org : http://www.androidtech.com/html/wordnet-mysql-20.php
This way you can check and suggest like the way Google does.
You can also try Pspell Functions - http://www.php.net/manual/en/ref.pspell.php
The only thing you need to get is pspell_config_data_dir -- location of language data files : http://www.php.net/manual/en/function.p ... ta-dir.php
The only thing you need to get is pspell_config_data_dir -- location of language data files : http://www.php.net/manual/en/function.p ... ta-dir.php