Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python3中的Stopwords_Python_Stop Words - Fatal编程技术网

Python3中的Stopwords

Python3中的Stopwords,python,stop-words,Python,Stop Words,我无法使用stop中的导入stopwords\u words import stopwords,因为它们声明模块不存在。我是否可以输入另一个命令来删除大约900个stopwords 我知道有100多个stopwords命令,但我正在尝试找到一个可以删除大约900个stopwords的命令。您可以使用nltk库轻松实现这一点。首先,您需要转到shell并安装pip安装nltk(注意,对于python3,选择pip3,而不是pip)。之后,您可以通过nltk直接从python轻松获取并下载stopw

我无法使用stop中的
导入stopwords\u words import stopwords
,因为它们声明模块不存在。我是否可以输入另一个命令来删除大约900个stopwords


我知道有100多个stopwords命令,但我正在尝试找到一个可以删除大约900个stopwords的命令。

您可以使用
nltk
库轻松实现这一点。首先,您需要转到shell并安装
pip安装nltk
(注意,对于python3,选择
pip3
,而不是
pip
)。之后,您可以通过nltk直接从python轻松获取并下载stopwords语料库,如下所示:

import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
print(stopwords.words('english'))
现在已经下载了语料库,您可以这样使用它:

import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
print(stopwords.words('english'))

这将打印出英语语料库中所有停止词的列表。其他语言可用。

是否安装了stop words软件包?是否先安装了该软件包?如果您正在使用pipi,您需要首先安装停止字
pip。我正在使用jupyter。是否有命令让我在jupyter中下载停止字软件包?也许本文会有所帮助: