【问题标题】:NLTk POS Tagger ErrorNLTk POS 标记错误
【发布时间】:2015-03-25 16:26:22
【问题描述】:

我安装了 32 位 Python 3.4.1,并且正在使用 NLTK 3。所有集合和模型都已安装。进入时

>>> text = nltk.word_tokenize("this is not working")
>>> text
['this', 'is', 'not', 'working']
>>> nltk.pos_tag(text)

或本地文件中的令牌

尝试使用 maxent_treebank_pos_tagger 的 pos_tag 时出现以下错误

Traceback (most recent call last):
  File "<pyshell#72>", line 1, in <module>
    nltk.pos_tag(text)
  File "C:\Python34\lib\site-packages\nltk\tag\__init__.py", line 100, in pos_tag
    tagger = load(_POS_TAGGER)
  File "C:\Python34\lib\site-packages\nltk\data.py", line 779, in load
    resource_val = pickle.load(opened_resource)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcb in position 0: ordinal not in range(128)

救命!

【问题讨论】:

    标签: python nltk pos-tagger


    【解决方案1】:

    我将错误追溯到 Windows 7 系统和编码。

    我关注了这个帖子的答案,https://stackoverflow.com/a/25590163/1956823 在 Mac 10.10 系统上试了一下,改了编码就行了!

    【讨论】:

      猜你喜欢
      • 2016-07-02
      • 1970-01-01
      • 1970-01-01
      • 2015-03-23
      • 2013-01-08
      • 1970-01-01
      • 1970-01-01
      • 2013-12-18
      • 2014-09-22
      相关资源
      最近更新 更多