📜  删除停用词 python - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:20.150000             🧑  作者: Mango

代码示例3
from nltk.tokenize import word_tokenize,sent_tokenize            # import tokenize
from nltk.corpus import stopwords                                #import stopwords
sw=stopwords.words("english")           # to get stopwords in english
text="hello i need to go For a walk but i don't know where to walk and when to walk to make my walk plesant."
final=[]
for word in word_tokenize(text):            #itterate each word in text
    if word not in sw:
            final.append(word)
final