Improve ngram module, still some bugs.