Forum Moderators: coopster

Message Too Old, No Replies

Spell Checker with custom dictionary

         

Jeremy_H

6:07 pm on May 9, 2006 (gmt 0)

10+ Year Member



Hello,

I have a custom 404 error page I have created.

What I would like is for the requested file to run through a short list I created of files that do exist. Then output matches that are close.

Something like:

"404 Error - File Not Found
You requested http://www.example.com/flie/
This file does not exist.
Did you mean:
http://www.example.com/file/"

I would imagine what I need would be some kind of spell checking application, and I create a custom dictionary of the list I want to check against.

Is this the best way of doing this, and are there any small spell checker scripts that one might suggest?

Thanks.

Little_G

6:18 pm on May 9, 2006 (gmt 0)

10+ Year Member



Hi,

There are built-in functions that may help you to look for mis-spellings in a url
methopone [uk.php.net]
levenshtein [uk.php.net]
similar-text [uk.php.net]
You can use one these to check against a list of keywords or similar urls.

Andrew

Jeremy_H

8:15 pm on May 9, 2006 (gmt 0)

10+ Year Member



Wow!

I didn't realize PHP had such awesome built in functions.

Thanks Andrew, that lead me to my solution!

RedBaron

3:58 am on May 10, 2006 (gmt 0)

10+ Year Member



Awesome! I didn't know either.

Habtom

5:35 am on May 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




Check soundex [php.net] too.

Hab