compute accuracy of ngram models