first go to http://nltk.org/install.html to download the relevant installer, and then
In the cmd window, go to scripts within the Python folder, run easy_install pip install Pyyaml and nltk:pip install Pyyaml NLTK
This completes the NLTK installation and can be tested.
Then enter the following code to access the NLTK data source download interface:
Import Nltknltk.download ()
Select all, set the download path (Download Directory), and then click Download, the system began to download the NLTK data package, download time is long, we have to wait patiently. If an individual packet cannot be downloaded, you can switch to the All Packages tab and double-click the specified package to download:
If not, you can also go directly to Http://nltk.googlecode.com/svn/trunk/nltk_data/index.xml to download the packet, just copy the packet to your download Directory directories.
Installing NLTK
Form Nltk.book Import *
Typing the above code can be shown in the diagram, it means that the NLTK packets are installed ~
Practice. Using NLTK for string queries
Text1.concordance (' monstrous ')
Description
Text1 is a large string of data sources in a NLTK packet. (The original text in the packet download directory of Gutenberg.zip in the Melville-moby_dick.txt)
Text1.concordance (' monstrous ') is the expression of the word "monstrous" from this large string of strings.
How to download and install NLTK in Python