Write ngrams to .gz files or stdout.