【问题标题】:How to remove words other than Stopwords from countvectorizer如何从 countvectorizer 中删除除停用词以外的单词
【发布时间】:2018-05-26 00:32:28
【问题描述】:

我只想保留作为停用词传递给 countvectorizer 的单词。

CV= CountVectorizer(max_features=500,stop_words= frozenset(["word1", "word2","word3"]))

如何做到这一点。

【问题讨论】:

    标签: scikit-learn nlp


    【解决方案1】:

    IIUC 你想使用vocabulary parameter 而不是stop_words

    CV = CountVectorizer(max_features=500, vocabulary=["word1","word2","word3"])
    

    【讨论】:

      猜你喜欢
      • 2018-10-13
      • 2018-09-28
      • 1970-01-01
      • 1970-01-01
      • 2021-01-26
      • 1970-01-01
      • 2013-05-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多