News for hackers. Stuff that matters.
Re:How to Write a Spelling Corrector (2007) by jonas21 on Friday March 28, 2014 @11:21AM (#7487785)
I think the code is correct. To implement smoothing, you want to add 1 to the count of every word, regardless of whether it appears in the training data or not.

That 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.

Re:How to Write a Spelling Corrector (2007) by pwf on Friday March 28, 2014 @11:23AM (#7487801)
That makes sense, thanks!

I should learn to read...

Re:How to Write a Spelling Corrector (2007) by justinpombrio on Friday March 28, 2014 @11:50AM (#7487952)
This is a perfect example of where a (short) code comment would be helpful. The "lambda: 1" a notable piece of code, but it's hard to tell that at a glance.
Re:How to Write a Spelling Corrector (2007) by hnriot on Friday March 28, 2014 @11:58AM (#7488012)
no it's not, it's perfectly clearly documented in code. The smoothing is common practice in this area of software engineering.
Re:How to Write a Spelling Corrector (2007) by dljsjr on Friday March 28, 2014 @12:30PM (#7488240)
And yet this is written for people who aren't familiar with this area of software engineering. It's stated so right at the top of the article.
Re:How to Write a Spelling Corrector (2007) by hnriot on Friday March 28, 2014 @11:16PM (#7491259)
nonsense, any software dev that can't follow a lambda that adds 1 should be taken outside and shot.

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!