How to Write a Spelling Corrector (2007)
norvig.com
norvig.com
What's wrong with the language model? Counting occurrences in corpuses of text is not really good enough. There are very rare words that are nevertheless real words, and there are misspellings of common words (even in books) that are far more common than many actual words. You can easily find yourself in a situation where a correctly spelled rare word is corrected to a common misspelling of some other, much more common word.
What's wrong with the error model? Edit distance just isn't a very good error model. There are many common misspellings that aren't very close via additions or deletions. There are also one letter edits that completely change the meaning of something. These should be treated as a much bigger errors than modifications that have no effect on meaning.
For special contexts like Etsy where words like "jewelry" (also correctly spelled as "jewellery" in the UK), Swarovski, and "ACEO" are extremely common, you really need a custom language model. I just wanted to put this out there lest people be under the misapprehension that spell correction is quite as easy as this blog post makes it out to be.
https://news.ycombinator.com/item?id=10967
https://news.ycombinator.com/item?id=42587
https://news.ycombinator.com/item?id=665544
https://news.ycombinator.com/item?id=2034981
There are more ...
========
Other submissions without comment:
https://news.ycombinator.com/item?id=1225574
To do it really good, you have to look for context (previous words) and add learning behavior. This is done nicely in Swiftkey keyboard for android.
The next step is looking at characters close to mistyped character in keyboard layout. This is also done in Swiftkey.
I can't access the link right now... OK: http://web.archive.org/web/20140217174744/http://norvig.com/...
In [1]: from collections import defaultdict
In [2]: d = defaultdict(lambda: 1)
In [3]: d['foo'] += 1
In [4]: d['foo']
Out[4]: 2That is to say, a word that appears once should get a count of 2, and word that doesn't appear at all should get a count of 1.
I should learn to read...
When Norvig says talks of regular folks, he means people with 1/10th his IQ, which is still the top 1%. Norvig is so far out there on the IQ scale that I find it funny when some noob says he's found a bug!