onlyican Posted December 3, 2006 Share Posted December 3, 2006 Hey guysI have a site for disabled people, a find a friend systemOn the Register form I ask for there Disability (Helps to match people)During this, I have seen like 10 different spellings for one disabilityWhat I want is something like google has, If you mis-spell a word, google comes up with "Did you mean ..."How would I do this? Link to comment https://forums.phpfreaks.com/topic/29341-did-you-mean/ Share on other sites More sharing options...
keeB Posted December 3, 2006 Share Posted December 3, 2006 Very interesting concept.Im pretty sure google uses some proprietary software to generate this, but basically... heres what I would do.Create an array of proper spellings of a bunch of disabilities you know. like [code=php:0] $disabilities[] = ("disability1", "disability2", "disability3");[/code]Then, I would create a function which implements [b]strpos[/b] and searches for a partial word like 'bility' and returns their location in the array.Or, I would use a library which already has this functionality, as it's quite complex if you want to be accurate. Link to comment https://forums.phpfreaks.com/topic/29341-did-you-mean/#findComment-134538 Share on other sites More sharing options...
fert Posted December 4, 2006 Share Posted December 4, 2006 The Pspell library does just this. Link to comment https://forums.phpfreaks.com/topic/29341-did-you-mean/#findComment-134560 Share on other sites More sharing options...
redbullmarky Posted December 4, 2006 Share Posted December 4, 2006 yup.more specifically:[url=http://uk2.php.net/manual/en/function.pspell-suggest.php]pspell_suggest[/url]For a list of all the spelling functions, take a look [url=http://uk2.php.net/manual/en/ref.pspell.php]here[/url]the only thing i can think of is that some forms of disability are going to be more medical terms rather than general English, so you may need to delve a bit further into adding custom dictionaries to get it work how you want.cheersMark Link to comment https://forums.phpfreaks.com/topic/29341-did-you-mean/#findComment-134582 Share on other sites More sharing options...
onlyican Posted December 4, 2006 Author Share Posted December 4, 2006 thats what I was thinkingI know pspell works with basic english word, and words like "paralysed" which is still an English WordBut what about something like "Duchenne Muscular Disorder";The Duchenne word is gonna be funI have just noticed the functionspspell_add_to_personal();pspell_save_wordlist(); Link to comment https://forums.phpfreaks.com/topic/29341-did-you-mean/#findComment-134734 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.