以编程方式安装NLTK语料库/模型,即没有GUI下载器吗? [英] Programmatically install NLTK corpora / models, i.e. without the GUI downloader?
问题描述
我的项目使用NLTK.如何列出项目的语料库型号要求,以便可以自动安装?我不想单击nltk.download()
GUI,一个接一个地安装软件包.
My project uses the NLTK. How can I list the project's corpus & model requirements so they can be automatically installed? I don't want to click through the nltk.download()
GUI, installing packages one by one.
还可以冻结相同需求列表(例如pip freeze
)吗?
Also, any way to freeze that same list of requirements (like pip freeze
)?
推荐答案
NLTK站点确实在此页面底部列出了用于下载软件包和集合的命令行界面:
The NLTK site does list a command line interface for downloading packages and collections at the bottom of this page :
命令行使用情况随所使用的Python版本而异,但是在我的Python2.6安装上,我注意到我缺少'spanish_grammar'模型,并且效果很好:
The command line usage varies by which version of Python you are using, but on my Python2.6 install I noticed I was missing the 'spanish_grammar' model and this worked fine:
python -m nltk.downloader spanish_grammars
您提到列出项目的语料库和模型要求,虽然我不确定自动完成此操作的方法,但我认为我至少会分享这一点.
You mention listing the project's corpus and model requirements and while I'm not sure of a way to automagically do that, I figured I would at least share this.
这篇关于以编程方式安装NLTK语料库/模型,即没有GUI下载器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!