sklearn中一般使用CountVectorizer和TfidfVectorizer这两个类来提取文本特征,sklearn文档中对这两个类的参数并没有都解释清楚,本文的主要目的就是解释这两个类的参数的作用
(1)CountVectorizer
class sklearn.feature_extraction.text.CountVectorizer(input='content', encoding='utf-8', decode_error='strict', strip_accents=None, lowercase=True, preprocessor=None, tokenizer=None, stop_words=None, token_pattern='(?u)\b\w\w+\b', ngram_range=(1, 1), analyzer='word', max_df=1.0, min_df=1, max_features=None, vocabulary=None, binary=False, dtype=<class 'numpy.int64'>)
(分为三个处理步骤:preprocessing、tokenizing、n-grams generation)
参数:(一般要设置的参数是decode_error,stop_words='english',