停用词不删除一个词

Stopword not removing one word

我想在过滤过程中删除 'dan',但没有成功。 这是我的代码

for row in readCSV:
        _word = []
        username = row[0]
        date = row[1]
        text = row[2].lower()
        text = re.sub(r'@[A-Za-z0-9_]+','',text)
        text = re.sub(r'http\S+', '',text)

        text = replaceMultiple(text, ["!","@","#","$","%","^","&","*","(",
                                      ")","_","-","+","=","{","}","[","]",
                                      "\","/",",",".","?","<",">",":",";",
                                      "'",'"',"~","0","1","2","3","4","5","6","7","8","9"], '')
        text = text.strip()
        nltk_tokens = nltk.word_tokenize(text)
        stop_words = set(stopwords.words("indonesian"))
        stop_words_new = ['aku','dan','duh','hhhmmm','thn','nih','tgl',
                          'hai','jazz','bro','broo','msh','']
        new_stopwords_list = stop_words.union(stop_words_new)   

stop_words_new 中的单词已删除,'dan' 除外。 为什么?

该代码应该不起作用,因为您正在加入一个包含列表的集合。尝试将 stop_words_new 设为集合而不是列表