abstract ngram generation