nltk_data LookupError: Resource punkt not found. Please use the NLTK Downloader to obtain the resour

问题

报错:

[nltk_data] Error loading punkt: 
False

nltk_data LookupError: Resource punkt not found. Please use the NLTK Downloader to obtain the resour_第1张图片

LookupError: 
**********************************************************************
  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\\cunzhang/nltk_data'
    - 'D:\\Anaconda\\nltk_data'
    - 'D:\\Anaconda\\share\\nltk_data'
    - 'D:\\Anaconda\\lib\\nltk_data'
    - 'C:\\Users\\cunzhang\\AppData\\Roaming\\nltk_data'
    - 'C:\\nltk_data'
    - 'D:\\nltk_data'
    - 'E:\\nltk_data'
    - ''
**********************************************************************

使用nltk.download()无法下载,还是离线下载自己安装吧。

解决方案

离线下载

网址:
http://www.nltk.org/nltk_data/

下载:
在这里插入图片描述

将文件解压到以下的任意文件夹中

nltk_data LookupError: Resource punkt not found. Please use the NLTK Downloader to obtain the resour_第2张图片

文件放置的时候注意文件夹的格式(新建文件夹nltk_data, tokenizers)
nltk_data LookupError: Resource punkt not found. Please use the NLTK Downloader to obtain the resour_第3张图片

再次运行程序就好啦

你可能感兴趣的:(NLP,python)