preprocessing and ngram counting