Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: error problems for import some copora with nltk

Reply
Thread Tools

RE: error problems for import some copora with nltk

 
 
Tony Meyer
Guest
Posts: n/a
 
      12-22-2004
> I am trying to follow the tutorial, but I kept getting error messages
> about importing corpus as follows
>
> ================================================== =
> >>> from nltk.corpus import gutenberg

>
> Traceback (most recent call last):
> File "<pyshell#3>", line 1, in -toplevel-
> from nltk.corpus import gutenberg
> ImportError: cannot import name gutenberg
> ================================================== =
>
> I got the data files under c:\\python24\nltk\


Have you imported nltk before that line? Try this:

Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
>>> from nltk.corpus import gutenberg


I suspect you may be doing this:

Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from nltk.corpus import gutenburg

Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: cannot import name gutenburg

Note that if the corpus can't be found, you can still do the import (just
not use the corpus).

=Tony.Meyer

 
Reply With Quote
 
 
 
 
ekyungchung@gmail.com
Guest
Posts: n/a
 
      12-22-2004
Dear Tony.Meyer,

Thank you for answering this. I did exactly what you told me, but I got
following messages.
Do you have any idea?

================================================== ===========================
>>> import nltk
>>> from nltk.corpus import gutenberg


Traceback (most recent call last):
File "<pyshell#1>", line 1, in -toplevel-
from nltk.corpus import gutenberg
File "C:\Python23\lib\site-packages\nltk\corpus\__init__.py", line
134, in -toplevel-
from nltk.tokenreader import *
File "C:\Python23\lib\site-packages\nltk\tokenreader\__init__.py",
line 57, in -toplevel-
from nltk.tokenreader.treebank import *
File "C:\Python23\lib\site-packages\nltk\tokenreader\treebank.py",
line 15, in -toplevel-
from nltk.tokenreader.tagged import ChunkedTaggedTokenReader
File "C:\Python23\lib\site-packages\nltk\tokenreader\tagged.py", line
15, in -toplevel-
from nltk.tree import Tree
File "C:\Python23\lib\site-packages\nltk\tree.py", line 33, in
-toplevel-
from nltk.probability import ProbabilisticMixIn,
ImmutableProbabilisticMixIn
File "C:\Python23\lib\site-packages\nltk\probability.py", line 56, in
-toplevel-
import types, math, Numeric
ImportError: No module named Numeric
================================================== ==============================
Thanks gain,

Kyung in Texas,

 
Reply With Quote
 
 
 
 
Fredrik Lundh
Guest
Posts: n/a
 
      12-22-2004
<(E-Mail Removed)> wrote:

> Thank you for answering this. I did exactly what you told me, but I got
> following messages.
>
> Do you have any idea?


> ImportError: No module named Numeric


have you installed the Numeric library? see the NLTK download page for
details:

http://nltk.sourceforge.net/install.html

</F>



 
Reply With Quote
 
Jeff Shannon
Guest
Posts: n/a
 
      12-22-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

>Dear Tony.Meyer,
>
>Thank you for answering this. I did exactly what you told me, but I got
>following messages.
>Do you have any idea?
>
>================================================= ============================
>
>
>>>>import nltk
>>>>from nltk.corpus import gutenberg
>>>>
>>>>

>
>Traceback (most recent call last):
>[...]
>import types, math, Numeric
>ImportError: No module named Numeric
>
>


At a guess, the nltk package is dependent upon Numeric already being
installed, and you don't have Numeric. Check your nltk documentation to
see if there's particular versions of Numeric that are required, and
then ensure that you have (or get) an appropriate version.

Jeff Shannon
Technician/Programmer
Credit International

 
Reply With Quote
 
ekyungchung@gmail.com
Guest
Posts: n/a
 
      12-23-2004
Hi,

According to your advice, I installed the numeric library which is
numarray-1.1.1.win32-py2.4.exe, but I got the error message as follows.
Any help? frustrated...
================================================== ==============
>>> from nltk.corpus import gutenberg


Traceback (most recent call last):
File "<pyshell#1>", line 1, in -toplevel-
from nltk.corpus import gutenberg
File "C:\Python24\Lib\site-packages\nltk\corpus\__init__.py", line
134, in -toplevel-
from nltk.tokenreader import *
File "C:\Python24\Lib\site-packages\nltk\tokenreader\__init__.py",
line 57, in -toplevel-
from nltk.tokenreader.treebank import *
File "C:\Python24\Lib\site-packages\nltk\tokenreader\treebank.py",
line 15, in -toplevel-
from nltk.tokenreader.tagged import ChunkedTaggedTokenReader
File "C:\Python24\Lib\site-packages\nltk\tokenreader\tagged.py", line
15, in -toplevel-
from nltk.tree import Tree
File "C:\Python24\Lib\site-packages\nltk\tree.py", line 33, in
-toplevel-
from nltk.probability import ProbabilisticMixIn,
ImmutableProbabilisticMixIn
File "C:\Python24\Lib\site-packages\nltk\probability.py", line 56, in
-toplevel-
import types, math, Numeric
ImportError: No module named Numeric
================================================== ==============

Kyung

 
Reply With Quote
 
Jeff Shannon
Guest
Posts: n/a
 
      12-23-2004
(E-Mail Removed) wrote:

>Hi,
>
>According to your advice, I installed the numeric library which is
>numarray-1.1.1.win32-py2.4.exe, but I got the error message as follows.
>Any help? frustrated...
>================================================= ===============
>
>
>>>>from nltk.corpus import gutenberg
>>>>
>>>>

>
>[...]
>import types, math, Numeric
>ImportError: No module named Numeric
>
>


Numarray is not Numeric. You need to install Numeric, because NLTK
doesn't use numarray. (As I understand it, numarray is intended as a
replacement for Numeric, but modules/packages must be recoded to use it
-- it doesn't happen automatically.)

Jeff Shannon
Technician/Programmer
Credit International

 
Reply With Quote
 
ekyungchung@gmail.com
Guest
Posts: n/a
 
      12-23-2004
Dear Jeff,

Thank you, it was the numeric. After I installed the numeric library
which is Numeric-23.6.win32-py2.3.exe for python 2.3.4 verson, it is
working correctly.

Thank you again,

Kyung

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using NLTK in Java hussainsaiger@gmail.com Python 5 09-02-2008 03:22 PM
NLTK: Natural language processing in Python Steven Bird Python 1 05-26-2007 05:40 AM
NLTK, Random Sentence Generators? Passer By Python 8 04-12-2007 04:57 PM
error problems for import some copora with nltk ekyungchung@gmail.com Python 1 12-22-2004 07:15 AM
newbie NLTK question j_pennington_moore Python 0 07-20-2004 03:53 AM



Advertisments