nltk pos_tag usage

和自甴很熟 提交于 2019-12-01 03:46:46
Ram Narasimhan

Your Python installation is not able to reach maxent or treemap.

First, check if the tagger is indeed there: Start Python from the command line.

>>> import nltk

Then you can check using

>>> dir (nltk)

Look through the list to see if maxent and treebank are both there.

Easier would be to type

>>> "maxent" in dir(nltk)
>>> True
>>> "treebank" in dir(nltk)
>>> True

Use nltk.download() --> Models tab and check to see if the treemap tagger shows as installed. You should also try downloading the tagger again.

If you don't want to use the downloader gui, you can just use the following commands in a python or ipython shell:

import nltk
nltk.download('punkt')
nltk.download('maxent_treebank_pos_tagger')

Over 50 corpora and lexical resources such as WordNet: http://www.nltk.org/nltk_data/ for free. Use http://nltk.github.com/nltk_data/ as server index instead of googlecode Google code 401: Authorization Required

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!