Fix the sorting bug of NGramGenerateModel().