NLTk POS 标记器错误



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

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

或本地文件中的令牌

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

Traceback (most recent call last):
  File "<pyshell#72>", line 1, in <module>
    nltk.pos_tag(text)
  File "C:Python34libsite-packagesnltktag__init__.py", line 100, in pos_tag
    tagger = load(_POS_TAGGER)
  File "C:Python34libsite-packagesnltkdata.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)

帮助!

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

我按照这个线程的回答,https://stackoverflow.com/a/25590163/1956823在Mac 10.10系统上尝试更改了编码,它起作用了!

相关内容

最新更新