python nltk 使用问题
import nltk
import ssl
nltk.download()

LookupError:
**********************************************************************
Resource 'punkt_tab' not found.
Please use the NLTK Downloader to obtain the resource:
>>> import nltk
>>> nltk.download('punkt_tab')
For more information see: https://www.nltk.org/data.html
Attempted to load 'tokenizers/punkt_tab/english/'
Searched in:
- 'C:\\Users\\Administrator/nltk_data'
- 'E:\\Programs\\Python\\Python313\\nltk_data'
- 'E:\\Programs\\Python\\Python313\\share\\nltk_data'
- 'E:\\Programs\\Python\\Python313\\lib\\nltk_data'
- 'C:\\Users\\Administrator\\AppData\\Roaming\\nltk_data'
- 'C:\\nltk_data'
- 'D:\\nltk_data'
- 'E:\\nltk_data'
**********************************************************************
将瞎子啊的文件移动至上述文件夹下即可!
import nltk
import ssl
#nltk.download()
# # 绕过SSL验证(在某些环境下需要)
# try:
# _create_unverified_https_context = ssl._create_unverified_context
# except AttributeError:
# pass
# else:
# ssl._create_default_https_context = _create_unverified_https_context
# nltk.download('punkt')
#nltk.download('punkt_tab')
from nltk.tokenize import sent_tokenize, word_tokenize

浙公网安备 33010602011771号