NLTK panlex_lite giving me error

后端 未结 1 511
你的背包
你的背包 2020-12-17 05:15

I\'m trying to use NLTK for my NLP learning in Python.

Certain package called \"panlex_lite\" keeps giving me error so I tried using the following:

         


        
相关标签:
1条回答
  • 2020-12-17 05:44

    Here's a "dirty" hack:

    $ rm /Users/Harshil/nltk_data/corpora/panlex_lite.zip
    $ rm -r /Users/Harshil/nltk_data/corpora/panlex_lite
    $ python
    
    >>> import nltk
    >>> dler = nltk.downloader.Downloader()
    >>> dler._update_index()
    >>> dler._status_cache['panlex_lite'] = 'installed' # Trick the index to treat panlex_lite as it's already installed.
    >>> dler.download('all')
    

    Also, try earthy:

    pip install earthy
    

    TL;DR:

    import earthy
    path_to_nltk_data = '/home/yourusername/nltk_data/'
    earthy.download('all', path_to_nltk_data) # Excludes the third party (non-NLTK) packages.
    

    To download panlex_lite exclusively:

    import earthy
    earthy.download('panlex_lite', path_to_nltk_data)
    

    To download all third-party datasets not natively hosted on nltk_data github:

    import earthy
    earthy.download('third_party', path_to_nltk_data')
    
    0 讨论(0)
提交回复
热议问题