#38: Finding and Fixing Misspelled Words with pspell

Anyone who's used Google has misspelled a word in a search, for example, alternitive music. And Google always helpfully comes back with Did you mean alternative music?

If you have a search function on your site, the ability to suggest misspelled words when no results (or not enough results) are found is an extremely helpful feature, especially since a customer's lack of spelling ability might cost you a sale. Fortunately, there's a PHP module called pspell, which allows you to check a word's spelling and suggest a replacement from pspell's default dictionary. If you like, you can even create a custom dictionary. To start with, though, you'll need to make sure that your PHP has the pspell library ...

Get Wicked Cool PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.