立即下载 google colaboratory 中的所有 nltk 包
Download all nltk packages in google colaboratory at once
我想在我的 google colab 代码中使用停用词,当我导入有关 nltk 的内容时没有错误,但是当我在我的代码 google colab 中使用停用词时出现此错误:-
Resource 'corpora/stopwords.zip/stopwords/' not found. Please
use the NLTK Downloader to obtain the resource: >>>
nltk.download()
但是当我这样做时:-
import nltk
nltk.download()
它给了我所有的包列表,所以我必须 select 1 才能下载,在终端我可以 "all" 下载所有包但是我如何在 google 协作?我不想每次都添加一个名字来下载东西。这是我做 "nltk.download()":-
时 colab 向我展示的内容
NLTK 下载器
d) 下载 l) 列表 u) 更新 c) 配置 h) 帮助 q) 退出
Downloader> d
Download which package (l=list; x=cancel)?
有什么方法可以一次性将所有 nltk 包下载到我在 google colab 中的项目中?
当我遇到同样的问题时,我到达了这个页面。
我可以在 google colab 中将 "popular" 与此代码一起使用。
import nltk
nltk.download("popular")
您还有其他几个选择:
all-corpora......... All the corpora
all-nltk............ All packages available on nltk_data gh-pages
branch
all................. All packages
book................ Everything used in the NLTK Book
popular............. Popular packages
tests............... Packages for running tests
您可以将它们用作:
import nltk
nltk.download('book')
#or
nltk.download('tests')
#or
nltk.download('all-corpora')# not recommended as it download huge amount of data.
使用:
import nltk
nltk.download('all')
对我有用。
我想在我的 google colab 代码中使用停用词,当我导入有关 nltk 的内容时没有错误,但是当我在我的代码 google colab 中使用停用词时出现此错误:-
Resource 'corpora/stopwords.zip/stopwords/' not found. Please
use the NLTK Downloader to obtain the resource: >>>
nltk.download()
但是当我这样做时:-
import nltk
nltk.download()
它给了我所有的包列表,所以我必须 select 1 才能下载,在终端我可以 "all" 下载所有包但是我如何在 google 协作?我不想每次都添加一个名字来下载东西。这是我做 "nltk.download()":-
时 colab 向我展示的内容NLTK 下载器
d) 下载 l) 列表 u) 更新 c) 配置 h) 帮助 q) 退出
Downloader> d
Download which package (l=list; x=cancel)?
有什么方法可以一次性将所有 nltk 包下载到我在 google colab 中的项目中?
当我遇到同样的问题时,我到达了这个页面。
我可以在 google colab 中将 "popular" 与此代码一起使用。
import nltk
nltk.download("popular")
您还有其他几个选择:
all-corpora......... All the corpora
all-nltk............ All packages available on nltk_data gh-pages
branch
all................. All packages
book................ Everything used in the NLTK Book
popular............. Popular packages
tests............... Packages for running tests
您可以将它们用作:
import nltk
nltk.download('book')
#or
nltk.download('tests')
#or
nltk.download('all-corpora')# not recommended as it download huge amount of data.
使用:
import nltk
nltk.download('all')
对我有用。