http://www.let.rug.nl/vannoord/TextCat/
Python version:
http://thomas.mangin.com/data/source/ngram.py
It's something that is fun to implement and doesn't take more than a few hours at most.