Overview
This project is a Python implementation of n-gram language models, trained on the Lord of the Rings trilogy. Starting from the simplest version, a bigram, the project builds up through n-grams, then layers on three important improvements: pruning, backoff and Kneser-Ney smoothing.
The end result is a text generator that produces new Tolkien-like sentences. You can try it yourself at ngram.koenkaandorp.nl.