我正在学习Python,并尝试使用CountVectorizer删除一些单词。我想要的是替换count_vectorizer = CountVectorizer(stop_words='english')并从文件中读取停止字。下面是我的代码: # Load the library with the CountVectorizer methodimport numpy
可选地应用词干3。应用Ngram Tokenisation 4。将标记文本作为列表返回。SnowballStemmerfrom sklearn.feature_extraction.text import CountVectorizerdata = data.apply(lambda x: [stemmer.stem(word) for word in x])在此之后,我将函数实现到Sklearn中,A
reducer以列表的形式输出值,我将值传递给向量化器。train_test_splitfrom sklearn.feature_extraction.text import CountVectorizeris good for the goose", "A series", "A", "series"]
vectorize
我只想从一个专栏中删除所有的英语停用词,而其他专栏则保持不变。这是我从nltk.corpus中提取停用词列表的代码: from nltk.corpus import stopwords
stopWordsListEng = stopwords.words("english") 但我想添加我能想到的其他停用词: according accordingly across act actually 我还没有想出如何将它添加到现有的停用词<