小编Spo*_*ini的帖子

NLTK无法找到stanford-postagger.jar!设置CLASSPATH环境变量

我正在开发一个项目,要求我使用nltk和python标记标记.所以我想用这个.但想出了一些问题.我经历了很多其他已经问过的问题和其他论坛,但我仍然无法解决这个问题.问题是当我尝试执行以下操作时:


from nltk.tag import StanfordPOSTagger st = StanfordPOSTagger('english-bidirectional-distsim.tagger')


我得到以下内容:


    Traceback (most recent call last):

    `File "<pyshell#13>", line 1, in <module>
        st = StanfordPOSTagger('english-bidirectional-distsim.tagger')`

    `File "C:\Users\MY3\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nltk-3.1-py3.5.egg\nltk\tag\stanford.py", line 131, in __init__
        super(StanfordPOSTagger, self).__init__(*args, **kwargs)`

    `File "C:\Users\MY3\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nltk-3.1-py3.5.egg\nltk\tag\stanford.py", line 53, in __init__
        verbose=verbose)`

     `File "C:\Users\MY3\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nltk-3.1-py3.5.egg\nltk\internals.py", line 652, in find_jar
        searchpath, url, verbose, is_regex))`

     `File "C:\Users\MY3\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nltk-3.1-py3.5.egg\nltk\internals.py", line 647, in find_jar_iter
        raise LookupError('\n\n%s\n%s\n%s' % (div, msg, div))`

    LookupError: 

    ===========================================================================
      NLTK was unable to find stanford-postagger.jar! Set the CLASSPATH
      environment variable.

    ===========================================================================
Run Code Online (Sandbox Code Playgroud)

我已经设置了CLASSPATH - C:\Users\MY3\Desktop\nltk\stanford\stanford-postagger.jar 我也试过了C:\Users\MY3\Desktop\nltk\stanford …

python nltk pos-tagger stanford-nlp

11
推荐指数
1
解决办法
2万
查看次数

标签 统计

nltk ×1

pos-tagger ×1

python ×1

stanford-nlp ×1