How I Trie to Make Spelling Suggestions
blog.afterthedeadline.com
blog.afterthedeadline.com
http://code.google.com/p/pylevenshtein/
However, I've found the Jaro-Winkler distance to be more useful than the Levenshtein. You can find good implementations for Jaro out there as well.
Oh, and I glossed over the perl code, until I reread it and realized it was sleep code. First time hearing about this language...interesting.
[Edit: I wrote Sleep :) I don't promote it much but it's been with me for many years and I've applied it to a lot of problems including the NLP in AtD]
Nicely done! How far along is it? Writing Perl-ish code that targets the JVM seems inspired to me.
Object oriented? Can write threaded code and all that? (there's been a number of times where Perl's shortcomings in those areas have prevented me from building better code).
It does threading using a fork(&function) abstraction. You can pass an initial set of variables to share but otherwise it's shared nothing. The fork returns an I/O handle which you can use to communicate values back and forth (even serialized objects). You can also wait(fork(&function)) to get a return value when the thread finishes.
The Manual, covers the whole language: http://sleep.dashnine.org/manual/
An article talking about some of the fun things to do with continuations: http://today.java.net/pub/a/today/2008/07/24/fun-with-contin...
Blog with Sleep examples: http://www.jroller.com/sleepsnip/feed/entries/rss
There is also a web app server for it. http://www.hick.org/~raffi/moconti.html
You use a table of all prefixes of all dictionary words. This might be more or less efficient than a trie, depending on implementation; but in interpreted Python the built-in hashtables are bound to win.
(It's descended from code I sent in response to http://norvig.com/spell-correct.html, rewritten to return a dict of candidates each paired with a description of how it's different from the original word. There's a bug of sorts in that the result set misses a very few candidates his first article's code finds, unless you extend the edit-distance cutoff; I only noticed the problem after I'd mailed him the code. I'm not sure if the OP's algorithm has the same shortcoming -- I haven't read it closely.)
http://blog.notdot.net/2007/4/Damn-Cool-Algorithms-Part-1-BK...
I don't know off the top of my head which one is more efficient.