add ngram implementation