TPGenerator function

Generates transition probabilities for n-grams