NLTK 无法导入特定的语料库 (pl196x)

问题描述

我的 NLTK 神秘地拒绝导入语料库 pl196x(包含在语料库的标准包中)。当我做 ` 时,一切都很顺利,但使用 from nltk.corpus import brown 时,总是

from nltk.corpus import pl196x

它已经发生在多台 PC 和操作系统上。

  1. 我做了 nltk.download() 所有语料库,它们显示为已下载
  2. 文件在那里

nltk data folder

  1. 我检查了 Traceback (most recent call last): File "<input>",line 1,in <module> ImportError: cannot import name 'pl196x' from 'nltk.corpus' (C:\my\path\to\__init__.py),它确实包含 nltk.data.path

我不知道出了什么问题 - 目前对我来说唯一可能的解释是语料库以某种方式停止了。任何指针将不胜感激。

解决方法

导入 pl196x 语料库的适当方法是使用:

from nltk.corpus.reader import pl196x

这是由 documentation of the module 暗示的。