xbl1 Posted February 10, 2008 Share Posted February 10, 2008 Hi;I'd like to ask you that how i can create a search function with hint when the user misspelling some word.For example:i type a string like the "ful text serch mysql" in google, and it will ask me"Did you mean: full text search mysql?"what king of knowledge can help me to do that? Thanks Link to comment Share on other sites More sharing options...
jhecht Posted February 10, 2008 Share Posted February 10, 2008 i believe it deals with levenshtein(sp?) calculations. http://us3.php.net/manual/en/function.levenshtein.php is the place to look at. I'm guess you'll need a word DB and etc etc.. If anyone else knows a different way to do so then go for it, but i believe this is how google does it. Link to comment Share on other sites More sharing options...
Synook Posted February 10, 2008 Share Posted February 10, 2008 I used to know that as "Edit distance"... but I suppose Levenshtein sounds more complex :)Edit: I found an XML dictionary which you can reference when performing spell-checks: http://www.ibiblio.org/webster/ Link to comment Share on other sites More sharing options...
xbl1 Posted February 10, 2008 Author Share Posted February 10, 2008 i believe it deals with levenshtein(sp?) calculations. http://us3.php.net/manual/en/function.levenshtein.php is the place to look at. I'm guess you'll need a word DB and etc etc.. If anyone else knows a different way to do so then go for it, but i believe this is how google does it.Thanks a lot, but this method has a disadvantage that i need to store all the words into the array first. I think it may be has a defined function which has stored most of the words for us, like a dictionary. Link to comment Share on other sites More sharing options...
jhecht Posted February 10, 2008 Share Posted February 10, 2008 thats why you would use a database to hold and index words that are searched. you would then use php and mysql to put those values into the array and calculate levenshtein's Link to comment Share on other sites More sharing options...
xbl1 Posted February 10, 2008 Author Share Posted February 10, 2008 thats why you would use a database to hold and index words that are searched. you would then use php and mysql to put those values into the array and calculate levenshtein'si known what you mean now, thanks Link to comment Share on other sites More sharing options...
justsomeguy Posted February 11, 2008 Share Posted February 11, 2008 Many databases have functions for computing the Levenshtein or Soundex distances between two strings. If the dictionary is stored in a database then a query will return matches within a certain threshold. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.