Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #48534

Natural Language Processing with Python .dispersion_plot returns nothing

Newsgroups comp.lang.python
Date 2013-06-17 09:31 -0700
Message-ID <05bb0af7-a20b-4b89-92bb-ff25ebd6919e@googlegroups.com> (permalink)
Subject Natural Language Processing with Python .dispersion_plot returns nothing
From sixtyfourbit <davidcpell@gmail.com>

Show all headers | View raw


I'm in the first chapter of Natural Language Processing with Python and am trying to run the example .dispersion_plot. I am using Python 2.7.4 (Anaconda) on Mac OSX 10.8.

When I load all of the necessary modules and try to create the dispersion plott, I get no return - no plot, no error message, not even a new >>> prompt, just a blinking cursor under the last line I typed. Here is what I've been doing:

[~]:  python
Python 2.7.4 |Anaconda 1.5.1 (x86_64)| (default, May  9 2013, 12:12:00) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import matplotlib
>>> 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
>>> text4.dispersion_plot(["citizens", "democracy", "freedom", "duties", "America"])

...and nothing. I can't paste it but my cursor is just blinking under my last command with no prompt. So far the other example commands from the chapter (e.g. .concordance) work fine, so I'm guessing the problem is something with numpy or matplotlib. I had a heck of a time getting matplotlib installed correctly (kept getting errors saying that it wasn't installed even when I had installed it), but since switching to the Anaconda distro, which had those prepackaged, I haven't gotten any module errors.

Any advice??

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Natural Language Processing with Python .dispersion_plot returns nothing sixtyfourbit <davidcpell@gmail.com> - 2013-06-17 09:31 -0700
  Re: Natural Language Processing with Python .dispersion_plot returns nothing John Gordon <gordon@panix.com> - 2013-06-17 16:38 +0000
    Re: Natural Language Processing with Python .dispersion_plot returns nothing sixtyfourbit <davidcpell@gmail.com> - 2013-06-17 09:47 -0700
  Re: Natural Language Processing with Python .dispersion_plot returns nothing Peter Otten <__peter__@web.de> - 2013-06-17 19:42 +0200
  Re: Natural Language Processing with Python .dispersion_plot returns nothing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-17 23:16 +0000

csiph-web