NLTK library installation tutorial (detailed version)

NLTK , Natural Language Toolkit (Python Natural Language Toolkit)
installation steps
1. Open the cmd command and enter:

pip install nltk

Run the installation
insert image description here
2. After the installation is complete, search for IDLE to open the python shell, enter

import nltk

To reference the toolkit, enter

nltk.download()

insert image description here
After pressing enter
insert image description here
, an error window will appear at this time, don't worry, we need to manually download the nltk package by ourselves. There are two ways to download.
(1) Download
nltk_data from the website (probably because of the network speed, I always fail to download)
insert image description here
After downloading, unzip the file and rename the packages file to nltk_data.
(2) Network disk download
link: https://pan.baidu.com/s/1flKxYLeVnuqXGJ6PGaSGyg
Extraction code: bo7h
downloaded compressed package, after decompression, you can get nltk_data file directly.
insert image description here

Through the above two methods, we can get the nltk_data file
insert image description here
and then put the nltk_data file in the installation path, pay attention to put it in the Roaming folder.
According to the above operations, the download of the nltk package is complete.
3. After closing the pop-up window, enter in the python shell

import nltk
nltk.download()
from nltk.book import *

insert image description here
The appearance of text1-text9 in the figure indicates that the nltk installation is successful.

This article draws on
the NLTK installation method
mainly to record your own installation process. If there is any infringement, you can contact to delete it.

Guess you like

Origin blog.csdn.net/weixin_51327281/article/details/127700781