add tf_idf method and fix ngram method