Started making it work with arbitrary ngram size, not done, heading to lunch
Works with arbitrary <n>gram