Showing posts with label Peter Norvig. Show all posts
Showing posts with label Peter Norvig. Show all posts

Saturday, January 19, 2008

Applied Probability: How To Write A Spelling Corrector In 21 Lines Of Python

Once again Bayes' Theorem comes in handy. This time, Peter Norvig shows us how to make a not-so-bad spelling corrector. It was done in 21 lines of easy-to-understand Python! I actually could understand it in one pass of reading. (It usually takes me many reading passes to understand any algorithm--I'm dense that way.)

If you have children, they should have some basic math and probability skills. Rational thoughts need those skills. Otherwise, they won't be able to make quantitative comparisons.

Sunday, December 16, 2007

Solving Sudoku Puzzles

I was thinking about writing a program to solve Sudoku puzzles for fun. Before I started writing, I did a quick Google search to see what programs are available. The search turned up many results, the most impressive of which is this essay by Peter Norvig (who co-wrote a famous AI book and is currently the Director of Research at Google)

The full Python source is only about 100 lines and it solves hard Sudoku puzzles very quickly. Therefore, my plan to write the ultimate Sudoku solver is derailed by Dr. Norvig's brilliance

:-D

By the way, Dr. Norvig has a lot of interesting essays that anyone working with computers should take a look. My favorites are Gettysburg Powerpoint Presentation (hilarious), Einstein '05 Performance Review (even more hilarious!), Teach Yourself Programming in Ten Years (no, not a joke, but wise), and The Python IAQ: Infrequently Answered Questions.
--- - ---- - ----- ---------

P.S. I also found this extremely hilarious link about how NOT to solve Sudoku. (You need to click on Ron Jeffries' attempts for hilarity.)