renamed updateNgramCounts