Send Close Add comments: (status displays here)
Got it!  This site "robinsnyder.com" uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.  Note: This appears on each machine/browser from which this site is accessed.
Python and NLTK: Install
by RS  admin@robinsnyder.com : 1024 x 640


1. Python and NLTK: Install
The Python NLTK (Natural Language Tool Kit) has many capabilities for NLP (Natural Language Processing).

2. Import NLTK
Start the interactive shell for Python.

Type the following command.
import ntlk

If there is no error message, then NTLK is installed. Otherwise, install NTLK using the following command.

3. Install NLTK if necessary
The Python nltk package will be used. One way to install the nltk package is as follows.
D:\Python38\Scripts\pip3.exe install nltk

Use the path to your installed version of Python.

4. Download more features
Now type the following command.
ntlk.download()


5. NLTK Downloader
NLTK DownloaderThe NLTK Downloader as a GUI should appear. You can now download from the following tabs.

6. Downloads
Before downloading anything, you may want to change the download directory. To do this, select "File", "Change Download Directory".

In the "Collections" tab you can select "all" for "All packages", which can take a while and use if to 2 GB of space. Or, you can download parts as you need them.

7. Download books
NLTK Download booksFor example, select "book" and select "Download".

8. Import the books
From the Python command line (from above) type the following command.
from nltk.book import *

You should see something similar to the following where ">>>" is the Python interpreter command prompt.
>>> import nltk >>> from nltk.book import * *** Introductory Examples for the NLTK Book *** Loading text1, ..., text9 and sent1, ..., sent9 Type the name of the text or sentence to view it. Type: 'texts()' or 'sents()' to list the materials. text1: Moby Dick by Herman Melville 1851 text2: Sense and Sensibility by Jane Austen 1811 text3: The Book of Genesis text4: Inaugural Address Corpus text5: Chat Corpus text6: Monty Python and the Holy Grail text7: Wall Street Journal text8: Personals Corpus text9: The Man Who Was Thursday by G . K . Chesterton 1908 >>>


9. End of page

by RS  admin@robinsnyder.com : 1024 x 640