Add ngram implementation.