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

Natural Language Toolkit(NLTK),自然语言处理工具包

在使用ntlk时,报错如下

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

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

  Attempted to load tokenizers/punkt/english.pickle

  Searched in:
    - 'C:\\Users\\xdd\\nltk_data'
    - 'D:\\program\\anaconda3\\pero\\nltk_data'
    - 'D:\\program\\anaconda3\\pero\\share\\nltk_data'
    - 'D:\\program\\anaconda3\\pero\\lib\\nltk_data'
    - 'C:\\Users\\“xdd”\\AppData\\Roaming\\nltk_data'
    - 'C:\\nltk_data'
    - 'D:\\nltk_data'
    - 'E:\\nltk_data'
    - ''
**********************************************************************

解决方法:

1.首先按照提示,把nltk_data包下载下来(会存在网络原因下载不下来,可以自行去网上搜索);

2.如果nltk_data包已经下载下来了,需要把解压后的nltk_data文件夹复制到以上Searched in中任意一个文件夹中即可。

posted @ 2022-10-25 10:56  wdgde  阅读(1562)  评论(0)    收藏  举报