当前位置:   article > 正文

nltk.download(‘stopwords‘)之类问题解决方案_resource stopwords not found. please use the nltk

resource stopwords not found. please use the nltk downloader to obtain the r

nltk.download(‘stopwords’)之类问题解决方案

第一部分:报错结果

  Resource stopwords not found.
  Please use the NLTK Downloader to obtain the resource:

  >>> import nltk
  >>> nltk.download('stopwords')
  
  For more information see: https://www.nltk.org/data.html

  Attempted to load corpora/stopwords

  Searched in:
    - 'C:\\Users\\CXY/nltk_data'
    - 'E:\\appData\\Anaconda\\im2recipetransformers\\nltk_data'
    - 'E:\\appData\\Anaconda\\im2recipetransformers\\share\\nltk_data'
    - 'E:\\appData\\Anaconda\\im2recipetransformers\\lib\\nltk_data'
    - 'C:\\Users\\CXY\\AppData\\Roaming\\nltk_data'
    - 'C:\\nltk_data'
    - 'D:\\nltk_data'
    - 'E:\\nltk_data'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

第二部分:解决方案

原因:由于网络问题,大部分的NLTK数据下载都会报错,离线下载可以很好的解决

step1:选择一个找到被nltk检索的目录(报错结果可见),创建nltk_data文件夹
  Searched in:
    - 'C:\\Users\\CXY/nltk_data'
    - 'E:\\appData\\Anaconda\\im2recipetransformers\\nltk_data'
    - 'E:\\appData\\Anaconda\\im2recipetransformers\\share\\nltk_data'
    - 'E:\\appData\\Anaconda\\im2recipetransformers\\lib\\nltk_data'
    - 'C:\\Users\\CXY\\AppData\\Roaming\\nltk_data'
    - 'C:\\nltk_data'
    - 'D:\\nltk_data'
    - 'E:\\nltk_data'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
step2:下载安装nltk数据

方式1:在官方网站找到需要的数据放于nltk_data文件夹下
github官方下载链接
方式2:通过分享的百度网盘下载(部分nltk数据)

链接:https://pan.baidu.com/s/1TjK35-IPIc5HZuduueFAPQ?pwd=6le9
提取码:6le9

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/神奇cpp/article/detail/972840
推荐阅读
相关标签
  

闽ICP备14008679号