是否有任何 python 库可用于搜索特定词,例如 "the"、"is"、"was"、"am" .... 以及其他类似词?

Is there any python library for searching specific words like "the", "is", "was", "am" .... and other similar words?

我想从文本文件中排除这些词。目前,我的代码只计算文本文件中所有单词的出现次数,但我想排除前面提到的不需要的单词,只计算某些重要单词的出现频率。文件中有很多重要的词,所以我不能把它们都包括在内。所以如果 python

中有一个预先存在的库会很有帮助

这样的词称为停用词,您可以使用 nltk 库轻松删除它们

from nltk.corpus import stopwords
# print(list(stopwords.words('english')))
filtered_words = [word for word in word_list if word not in stopwords.words('english')]