update n-grams