To stop words

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

Guess you like

Origin www.cnblogs.com/rise0111/p/11563355.html