报错:LookupError:
**********************************************************************
Resource not found.
Please use the NLTK Downloader to obtain the resource:
>>> import nltk
>>> nltk.download('')
For more information see: https://www.nltk.org/data.html
Attempted to load ./
Searched in:
- '/home/xxx/nltk_data'
一、nltk需要下载的文件、模型没找到
自行下载:
wget https://paddlespeech.bj.bcebos.com/Parakeet/tools/nltk_data.tar.gz
tar zxvf nltk_data.tar.gz
解决方法:
1、检查
>>> nltk.find('.')
FileSystemPathPointer('/你的路径/nltk_data')
成功
二、ntlk_data文件移动了,想重新更改nltk.find()路径目录
sudo vi /etc/profile
export NLTK_DATA="/你的新路径/nltk_data"写到文件末尾
source /etc/profile
vi ~/.bashrc
export NLTK_DATA="/你的新路径/nltk_data"写到文件末尾
source ~/.bashrc