21. October 2013

A PHP spell checker

How to Write a Spelling Corrector, by Peter Norvig, is a popular resource for instructions on how to produce spell check functionality. That page does some statistical Analysis of how this algorithm works and is definitely worth reading.

I’ve rewritten this alghorithm in PHP. It’s not as eloquent as the python code in the original, but I suspect it gains a tiny bit of readability in the trade-off for terseness.

more

09. October 2013

A Lattice class

Consider if you need a 7-dimensional lattice data structure. An array is great for one-dimensional data but once you add dimensions things quickly get difficult to manage. Here’s a data structure that takes away some of that headache:

more