1.filtered_words = [w for w in word_list if not w in stopwords.words('english')]
2. 我想您有您想要删除停用词字(WORD_LIST)的列表。你可以这样做:filtered_word_list = word_list[:] #make a copy of the word_list
for word in word_list: # iterate over word_list
if word in stopwords.words('english'):
filtered_word_list.remove(word) # remove word from filtered_word_list if it is a stopword
3. 你也可以做一组差异,例如:list(set(nltk.regexp_tokenize(sentence, pattern, gaps=True)) - set(nltk.corpus.stopwords.words('english')))