NLTK installation and corpus package download
Use the command
pip install nltk
The NLTK corpus and many modules
can be installed using the NLTK downloader
import nltk
nltk.download()
After running, it is found that the web page cannot be opened successfully, and the download of the nltk corpus fails, and an error is reported: Unable to connect. Or the download is extremely slow. Here you can directly download to the designated directory and decompress the
designated directory:
Data package download:
Baidu Netdisk
Link: https://pan.baidu.com/s/108PCcxz1sLuOT1YAbmYf9g
Extraction code: p2zn
Confirm whether the NLTK data is downloaded successfully
Use the following command to confirm whether the NLTK data package is installed successfully, as shown in the figure below, the installation is successful
from nltk.book import *
Reference blog post: https://blog.csdn.net/qiang12qiang12/article/details/81254595