去停用词
Posted rise0111
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了去停用词相关的知识,希望对你有一定的参考价值。
import pandas as pd
stop_words = []
with open('data/stop_words.txt','r',encoding='utf-8') as f:
lines = f.readlines()
for i in lines:
word = i.strip()
stop_words.append(word)
print(stop_words[:10])
def clean_stopwords(text,stop_words):
data = []
for sentence in text:
data.append([ word for word in sentence if word not in stop_words])
return data
以上是关于去停用词的主要内容,如果未能解决你的问题,请参考以下文章