Windows10,Python3环境下nltk的nltk_data下载缓慢问题

穿精又带淫゛_ 提交于 2020-01-09 15:21:04

Windows10,Python3环境下nltk的nltk_data下载缓慢问题

NLTK是一个高效的Python构建的平台,用来处理人类自然语言数据。它提供了易于使用的接口,通过这些接口可以访问超过50个语料库和词汇资源(如WordNet),还有一套用于分类、标记化、词干标记、解析和语义推理的文本处理库,以及工业级NLP库的封装器和一个活跃的讨论论坛。
但其在windows平台下的下载与安装常由于nltk_data等文件过于庞大,容易卡住或中断,现提供离线下载安装方法如下:

第一步

在github上下载nltk_data,网址为https://github.com/nltk/nltk_data,支持python3。下载packages目录,将packages目录下文件夹中所有的压缩包解压出来。

第二步

在Python终端下输入:

import nltk
nltk.data.find(".")

第三步

将第一步得到的若干文件夹移动至第二步得到的路径下(我的是C:\Users\Username\AppData\Roaming\nltk_data)

第四步

在终端输入代码进行测试:

from nltk.book import 

若出现如下结果,则代表安装有效:

*** Introductory Examples for the NLTK Book ***
Loading text1, ..., text9 and sent1, ..., sent9
Type the name of the text or sentence to view it.
Type: 'texts()' or 'sents()' to list the materials.
text1: Moby Dick by Herman Melville 1851
text2: Sense and Sensibility by Jane Austen 1811
text3: The Book of Genesis
text4: Inaugural Address Corpus
text5: Chat Corpus
text6: Monty Python and the Holy Grail
text7: Wall Street Journal
text8: Personals Corpus
text9: The Man Who Was Thursday by G . K . Chesterton 1908

参考

https://blog.csdn.net/zhangcucmb/article/details/80824231
https://blog.csdn.net/weixin_34293911/article/details/92394679

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!