虽然我希望使用 pos_tag 函数收集 POS 标签,但发生以下错误。我包含了 nltk 所需的所有包。nltk 版本为 3.3 并在 conda 环境中运行。python版本是3.6。每个 nltk 包都是使用 nltk 下载函数下载的,但是每次我运行 pos_tag 函数时都会引发以下错误。
>>> from nltk import pos_tag, word_tokenize
>>> pos_tag(word_tokenize("John's big idea isn't all that bad."))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\User\Anaconda3\envs\sow\lib\site-packages\nltk\tag\__init__.py", line 133, in pos_tag
tagger = _get_tagger(lang)
File "C:\Users\User\Anaconda3\envs\sow\lib\site-packages\nltk\tag\__init__.py", line 97, in _get_tagger
tagger = PerceptronTagger()
File "C:\Users\User\Anaconda3\envs\sow\lib\site-packages\nltk\tag\perceptron.py", line 141, in __init__
self.load(AP_MODEL_LOC)
File "C:\Users\User\Anaconda3\envs\sow\lib\site-packages\nltk\tag\perceptron.py", line 223, in load
self.model.weights, self.tagdict, self.classes = load(loc)
File "C:\Users\User\Anaconda3\envs\sow\lib\site-packages\nltk\data.py", line 836, in load
opened_resource = _open(resource_url)
File "C:\Users\User\Anaconda3\envs\sow\lib\site-packages\nltk\data.py", line 957, in _open
return find(path_, ['']).open()
File "C:\Users\User\Anaconda3\envs\sow\lib\site-packages\nltk\data.py", line 675, in find
raise LookupError(resource_not_found)
LookupError:
**********************************************************************
Resource [93mD:[0m not found.
Please use the NLTK Downloader to obtain the resource:
[31m>>> import nltk
>>> nltk.download('D:')
[0m
Searched in:
- ''
**********************************************************************