How to download and install NLTK in Python

Source: Internet
Author: User
Tags nltk

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.