changed ngrams to a global, since it's never modified.