Utilities used by ngram profiler.