Add new comment
I received the 2nd Common Lisp book that I ordered yesterday. Apparently it isn't the greatest book, but so far it isn't too bad. I really like that it, like the other book, has problems and exercises for students of the language to solve. One of the chapters covers string/character manipulation. In it, the book asks the student to implement a spell-checker and outlines four cases that need to be handled in order to find a misspelled word in the dictionary. The cases are: transposition, insertion, removal, replacement. Peter Norvig, a famed Lisp/AI programmer who works at Google, implemented a spell-checker in 21 lines of Python and this book has given me the idea that it's fairly straight forward to do.
Another exercise I found interesting was the implementation of Soundex. The book gives a description of the algorithm and describes the functions you will need, and then you're left on your own to figure it out. The algorithm can be used to index words by their Soundex code. This makes spelling correction slightly easier because you are no longer mutating a string until it comes close to a word in the dictionary, you are instead generating a code that can be matched; if it doesn't match then the word is incorrectly spelled.
Someone at PC Plus has written an article about using Soundex and the Levenshtein algorithms for spell-checking. This is a pretty good article, amazing that it was published in a consumer electronics magazine, heh.
Back to the book...it's nice so far and I feel like having two Common Lisp books which cover much of the language and use different examples/problems will help me apply whatever I learn in different and varied contexts. For example, I didn't realize how simple a spell checker was to implement and I may include it in future web applications. Another example is Prolog (from the first book I received in the mail) which has been difficult for me to wrap my head around.
