Jump to content

Did you Mean...


onlyican

Recommended Posts

Hey guys

I have a site for disabled people, a find a friend system

On the Register form I ask for there Disability (Helps to match people)

During this, I have seen like 10 different spellings for one disability

What 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

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

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.

cheers
Mark
Link to comment
https://forums.phpfreaks.com/topic/29341-did-you-mean/#findComment-134582
Share on other sites

thats what I was thinking

I know pspell works with basic english word, and words like "paralysed" which is still an English Word

But what about something like "Duchenne Muscular Disorder";
The Duchenne word is gonna be fun

I have just noticed the functions

pspell_add_to_personal();
pspell_save_wordlist();
Link to comment
https://forums.phpfreaks.com/topic/29341-did-you-mean/#findComment-134734
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.