I read the book -natural language processing with Python.
and I did exactly what the author said, downloaded all packages after installation of the NLTK.

then just input"from nltk.book import *"

SUPPOSE:

>>> 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
>>>




However, what I have as follows:



>>> 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.

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    from nltk.book import *
  File "C:\Python26-B\lib\site-packages\nltk\book.py", line 22, in <module>
    text1 = Text(gutenberg.words('melville-moby_dick.txt'))
  File "C:\Python26-B\lib\site-packages\nltk\corpus\util.py", line 99, in __getattr__
    self.__load()
  File "C:\Python26-B\lib\site-packages\nltk\corpus\util.py", line 64, in __load
    except LookupError: raise e
LookupError: 
**********************************************************************
  Resource u'corpora/gutenberg' not found.  Please use the NLTK
  Downloader to obtain the resource:  >>> nltk.download()
  Searched in:
    - 'C:\\Users\\equeacro plu/nltk_data'
    - 'C:\\nltk_data'
    - 'D:\\nltk_data'
    - 'E:\\nltk_data'
    - 'C:\\Python26-B\\nltk_data'
    - 'C:\\Python26-B\\lib\\nltk_data'
    - 'C:\\Users\\equeacro plu\\AppData\\Roaming\\nltk_data'
**********************************************************************
>>> 

Somebody helps me figure out what the problem is, thanks a lot.I did the same thing on a PC and a laptop, and had the same results.

Assuming you can import Tkinter, type

>>> import nltk
>>> nltk.download()

in the GUI which appears, select Everything from the nltk book and click download. Wait.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.