赞
踩
D:\CODEInterpreter\python3.6.8\python.exe D:/CODEFile/PythonCode01/PyTorch/ChatRobot/2/NLTK.py
[nltk_data] Error loading punkt: <urlopen error [Errno 11004]
[nltk_data] getaddrinfo failed>
Traceback (most recent call last):
File "D:/CODEFile/PythonCode01/PyTorch/ChatRobot/2/NLTK.py", line 7, in <module>
tokens = nltk.word_tokenize(sentence)
File "D:\CODEInterpreter\python3.6.8\lib\site-packages\nltk\tokenize\__init__.py", line 129, in word_tokenize
sentences = [text] if preserve_line else sent_tokenize(text, language)
File "D:\CODEInterpreter\python3.6.8\lib\site-packages\nltk\tokenize\__init__.py", line 106, in sent_tokenize
tokenizer = load(f"tokenizers/punkt/{language}.pickle")
File "D:\CODEInterpreter\python3.6.8\lib\site-packages\nltk\data.py", line 750, in load
opened_resource = _open(resource_url)
File "D:\CODEInterpreter\python3.6.8\lib\site-packages\nltk\data.py", line 876, in _open
return find(path_, path + [""]).open()
File "D:\CODEInterpreter\python3.6.8\lib\site-packages\nltk\data.py", line 583, in find
raise LookupError(resource_not_found)
LookupError:
**********************************************************************
Resource punkt not found.
Please use the NLTK Downloader to obtain the resource:
>>> import nltk
>>> nltk.download('punkt')
For more information see: https://www.nltk.org/data.html
Attempted to load tokenizers/punkt/english.pickle
Searched in:
- 'C:\\Users\\Administrator/nltk_data'
- 'D:\\CODEInterpreter\\python3.6.8\\nltk_data'
- 'D:\\CODEInterpreter\\python3.6.8\\share\\nltk_data'
- 'D:\\CODEInterpreter\\python3.6.8\\lib\\nltk_data'
- 'C:\\Users\\Administrator\\AppData\\Roaming\\nltk_data'
- 'C:\\nltk_data'
- 'D:\\nltk_data'
- 'E:\\nltk_data'
- ''
**********************************************************************
NLK是自然语言处理的官方库,Python上著名的自然语言处理库自带语料库,词性分类库自带分类,分词,等等功能。
**********************************************************************
Resource punkt not found.
Please use the NLTK Downloader to obtain the resource:
没有找到 punkt 资源包。
Searched in:
- 'C:\\Users\\Administrator/nltk_data'
- 'D:\\CODEInterpreter\\python3.6.8\\nltk_data'
- 'D:\\CODEInterpreter\\python3.6.8\\share\\nltk_data'
- 'D:\\CODEInterpreter\\python3.6.8\\lib\\nltk_data'
- 'C:\\Users\\Administrator\\AppData\\Roaming\\nltk_data'
- 'C:\\nltk_data'
- 'D:\\nltk_data'
- 'E:\\nltk_data'
- ''
搜索 punkt 资源包 在这些路径下查找过,但是没有找到。
punkt.zip
链接: https://pan.baidu.com/s/1H2qBy16qwLdDG_eTOQzlCg 提取码: rajj
任意选取一个路径:
创建目录 nltk_data,进入nltk_data,创建子目录 tokennizers,解压压缩包
【注意路径的层次,否则会失败】
异常已经解决OK!!!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。