Python NLTK pos_tag throws URLError

后端 未结 1 1485
陌清茗
陌清茗 2020-12-06 07:37

I was trying to use the pos_tag function in NLTK 3 (on Windows), but this error popped up:

>>> import nltk
>>> tokens = nltk.w         


        
相关标签:
1条回答
  • 2020-12-06 07:44

    EDITED

    This issue has been resolved from NLTK v3.2.1. Upgrading your NLTK would resolve the issue, e.g. pip install -U nltk.


    You might be using nltk verion 3.2 . Downgrade it to version 3.1 and it will work fine. I myself used the undermentioned method right now and the URL error is gone. Seems like an issue with nltk_version-3.2

    Browse to this directory on your computer

    C:\Users\USERNAME\AppData\Local\Continuum\Anaconda2\Lib\site-packages
             OR
    C:\python2.7\site-packages\
    

    Basically the aim is to go into site-packages directory, which holds the installed packages.

    Search and delete these files and directories :

    nltk-3.1.dist-info
    nltk
    

    After deleting force install older version as :-

    pip install nltk==3.1
    
    0 讨论(0)
提交回复
热议问题