我想在TfidfVectorizer中添加一些停用词。我按照此解决方案,将我的停用词列表中包含了英文的停用词和我指定的停用词。但是TfidfVectorizer仍然不接受我的停用词列表,我仍然可以在我的特征列表中看到那些词语。以下是我的代码:
from sklearn.feature_extraction import text
my_stop_words = text.ENGLISH_STOP_WORDS.union(my_words)
vectorizer = TfidfVectorizer(analyzer=u'word',max_df=0.95,lowercase=True,stop_words=set(my_stop_words),max_features=15000)
X= vectorizer.fit_transform(text)
我还尝试将TfidfVectorizer中的stop_words设置为stop_words=my_stop_words。但仍然无法正常工作。请帮忙。