This guy gives you a dictionary, but no source code.
Perhaps you could get a few ideas?

http://software.magneticpole.com/words/