Corrected loop index for length of ngram