微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法在 NLTK 中访问下载的语料库

如何解决无法在 NLTK 中访问下载的语料库

我已经通过 nltk.download 下载了俄语 NLTK 语料库,但我实际上无法使用它(Python 3.6.9、NLTK 3.5):

>>> nltk.download('averaged_perceptron_tagger_ru')
[nltk_data] Downloading package averaged_perceptron_tagger_ru to
[nltk_data]     /home/morozov/nltk_data...
[nltk_data]   Package averaged_perceptron_tagger_ru is already up-to-
[nltk_data]       date!
True
>>> nltk.corpus.averaged_perceptron_tagger_ru
Traceback (most recent call last):
  File "<stdin>",line 1,in <module>
  File "/home/morozov/.local/lib/python3.6/site-packages/nltk/lazyimport.py",line 122,in __getattr__
    return getattr(module,name)
AttributeError: module 'nltk.corpus' has no attribute 'averaged_perceptron_tagger_ru'

这似乎是这个特定语料库的一些问题,因为布朗语料库加载得很好:

>>> nltk.download('brown')
[nltk_data] Downloading package brown to /home/morozov/nltk_data...
[nltk_data]   Package brown is already up-to-date!
True
>>> nltk.corpus.brown
<CategorizedTaggedCorpusReader in '.../corpora/brown' (not loaded yet)>

我试过重启我的 Python 并重新下载语料库,没有任何变化。

如何让俄语语料库发挥作用?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。