Partitions each ngram by hashing on its first two words (first as in farthest away
from the current word), then mod by numPartitions.
Useful for grouping ngrams that share the first two words in context. An example
usage is the StupidBackoffEstimator.
type of each word (e.g. Int or String)
the desired number of partitions
a BackoffIndexer; required for retrieving first two words of ngrams