[BangPypers] NLTK: Dispersion Plot problem

JAGANADH G jaganadhg at gmail.com
Tue Aug 17 12:40:16 CEST 2010


On Tue, Aug 17, 2010 at 3:04 PM, Gaurav Kalra <gvkalra at gmail.com> wrote:

> Hi.
> I have been trying to learn NLTK (http://www.nltk.org/) following
> instructions over:
> http://nltk.googlecode.com/svn/trunk/doc/book/ch01.html
>
> The point at which I am stuck is using the function dispersion_plot() (
>
> http://nltk.googlecode.com/svn/trunk/doc/api/nltk.draw.dispersion-module.html#dispersion_plot
> )
>
> Here is the output of yolk:
> PyYAML          - 3.09         - active
> Python          - 2.6.5        - active development
> (/usr/lib/python2.6/lib-dynload)
> distribute      - 0.6.10       - active
> matplotlib      - 1.0.0        - active
> nltk            - 2.0b9        - active
> numpy           - 1.4.1        - active
> pip             - 0.7.2        - active
> wsgiref         - 0.1.2        - active development (/usr/lib/python2.6)
> yolk            - 0.4.1        - active
>
>
> I guess that dispersion_plot() requires matplotlib and numpy, which are
> already active but, running the function is not generating any dispersion
> graph as showed over here:
> http://nltk.googlecode.com/svn/trunk/doc/book/ch01.html
>


Have you got any error message.

Which version of NLTK you are using

Try this

from nltk import *
from nltk.book import *
text4.dispersion_plot(["citizens", "democracy", "freedom", "duties",
"America"])

If Numpy and matplotlib is present it will work.


-- 
**********************************
JAGANADH G
http://jaganadhg.freeflux.net/blog


More information about the BangPypers mailing list