I want to have a regex that fixes some common spelling errors on most of the noise words (see MySQL's noise word list as an example) and a few words on a short list I'll have for my project, like "company", which could be misspelled as cpmany or compayn.
The way it would work is to look for:
- punctuation or space
(- lowercase version of word only)
- punctuation or space
And then replace the item in parentheses above. There would be no prompting like, "Are you sure?" or identifying what we found. It would just fix them. Of course, this doesn't work with all kinds of spelling errors, but only certain spelling errors. And certain fields would be exempted such as Company Name because they might naturally have funky spellings (like Flickr for instance).
Any ideas on the best approach?
Fixing Common Spelling Errors
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Fixing Common Spelling Errors
There are many modules to handle this far better than any possible regex, including offering spelling suggestions.
http://ca.php.net/manual/tr/ref.pspell.php
Otherwise, google php spell check for an exhausting list of alternatives.
http://ca.php.net/manual/tr/ref.pspell.php
Otherwise, google php spell check for an exhausting list of alternatives.