Nltk: 您的 https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/index.xml 有问题

创建于 2017-04-14  ·  5评论  ·  资料来源: nltk/nltk

在 xml 在线验证器中告诉:

An error has been found! 
Click on  to jump to the error. In the document, you can point at  with your mouse to see the error message. 
Errors in file xml-schema: 
    23: 144 Attribute name "unzipped_size" associated with an element type "package" must be followed by the ' = ' character.

当我尝试在 python3 中下载stopwords

import nltk
nltk.download('stopwords')

出现错误

>>> import nltk
>>> nltk.download('stopwords')

Traceback (most recent call last):
  File "/usr/lib/python3.5/code.py", line 91, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/nltk/downloader.py", line 664, in download
    for msg in self.incr_download(info_or_id, download_dir, force):
  File "/usr/local/lib/python3.5/dist-packages/nltk/downloader.py", line 534, in incr_download
    try: info = self._info_or_id(info_or_id)
  File "/usr/local/lib/python3.5/dist-packages/nltk/downloader.py", line 508, in _info_or_id
    return self.info(info_or_id)
  File "/usr/local/lib/python3.5/dist-packages/nltk/downloader.py", line 875, in info
    self._update_index()
  File "/usr/local/lib/python3.5/dist-packages/nltk/downloader.py", line 825, in _update_index
    ElementTree.parse(compat.urlopen(self._url)).getroot())
  File "/usr/lib/python3.5/xml/etree/ElementTree.py", line 1184, in parse
    tree.parse(source, parser)
  File "/usr/lib/python3.5/xml/etree/ElementTree.py", line 596, in parse
    self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 23, column 143

在你的xml
<package checksum="6f9c042774b96366c93fd0f9a9adb697" id="dolch" name="Dolch Word List" size="2116" subdir="corpora" unzip="1" unzipped_size"1917" url="https://en.wikipedia.org/wiki/Dolch_word_list" />

unzipped_size"1917"必须是 unzipped_size="1917"
缺少等号

最有用的评论

很抱歉,nltk_data 端的代码被破坏了。 nltk/nltk_data#70 修补了它。

所有5条评论

同样的错误。 可以下载以前的版本吗?

@svfat我在 3.2.1 版本中发现了该错误,并升级到 3.2.2 并得到了同样的错误

很抱歉,nltk_data 端的代码被破坏了。 nltk/nltk_data#70 修补了它。

@alvations感谢快速修复

@alvations tnx 现在可以工作了。
即将到来的假期

此页面是否有帮助?
0 / 5 - 0 等级