Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python main.py nltk错误 #30

Open
horacehht opened this issue May 19, 2023 · 1 comment
Open

python main.py nltk错误 #30

horacehht opened this issue May 19, 2023 · 1 comment

Comments

@horacehht
Copy link

Resource [93mpunkt[om not found.Please use the NLTK Downloader to obtain theresource:
[31m>>> import nltk>>> nltk.download(' punkt')[omFor more information see: https://www.nltk.org/data.html
NLTK's dat
all"), or just tra and no gra
Attempted to load [93mtokenizers/punkt/PY3/english.pickle[om
Searched in:/home/horace/nltk data!/home/horace/.conda/envs/chatglm/nltk data!- '/home/horace/.conda/envs/chatglm/share/nltk data'/home/horace/.conda/envs/chatglm/lib/nltk data'
'/usr/share/nltk data'
'/usr/local/share/nltk data
‘/usr/lib/nltk data’
‘/usr/local/lib/nltk data’

终端中提示我import nltk后使用nltk.download('punkt'),但执行这条命令会失败。查询资料后去官网下载,解压后放到上述提到的指定位置,再运行main.py,发现还是出现这个错误。不知道怎么解决

@horacehht
Copy link
Author

解决了。需要在nltk_data目录中再创建一个tokenizers目录,然后把punkt放到tokenizers目录里面。
等会有个averaged_perceptron_tagger,也需要这样子操作。手动下载,然后在nltk_data下面新建一个taggers目录,然后把averaged_perceptron_tagger放到taggers下面。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant