RE: [PHP-DB] Offering alternatives in typing mistakes

2003-04-04 Thread John W. Holmes
 I'm currently doing a select like statement. No problem with that. But
as
 no
 human being is perfect ;-) the input
 provided by the user is sometimes full of typing mistakes like
 informatoin,
 or informatin instead of information.
 I hope you know what I'm think about. Google offers you an alternative
if
 google thinks you misspelled.
 Now my question, what is an algorithm for finding out which input was
 actually meant? I know I'll have to split
 the string like first letter than last letter, than second first etc.
Is
 there a better solution, like taking
 the middle? I've already put some thought in it, but I see no reason
to
 reinvent the wheel again. Has anybody
 any better ideas? I'm open to solutions.

Doing a search on google for spelling suggestion algorithm turned up a
few things. You may want to check them. You'll probably have to
implement an outside program. The only way from within PHP that I can
think of doing it is with soundex() and similar functions. I know MySQL
implements something similar within it, so you can search for words whos
soundex will match the soundex of the word the user supplied. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Offering alternatives in typing mistakes

2003-04-04 Thread Jason Wong
On Saturday 05 April 2003 04:11, Jan Bro wrote:

 I'm currently doing a select like statement. No problem with that. But as
 no human being is perfect ;-) the input
 provided by the user is sometimes full of typing mistakes like informatoin,
 or informatin instead of information.
 I hope you know what I'm think about. Google offers you an alternative if
 google thinks you misspelled.
 Now my question, what is an algorithm for finding out which input was
 actually meant? I know I'll have to split
 the string like first letter than last letter, than second first etc. Is
 there a better solution, like taking
 the middle? I've already put some thought in it, but I see no reason to
 reinvent the wheel again. Has anybody
 any better ideas? I'm open to solutions.

If you're going to be running on some *nix platform then have a look at the 
chapter on pspell.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Let us never negotiate out of fear, but let us never fear to negotiate.
-- John F. Kennedy
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php