pre-calculate sets of the ngrams