By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,539 Members | 1,289 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,539 IT Pros & Developers. It's quick & easy.

problems with nltk

P: n/a
hi,

Has anybody tried using natural language toolkit
(http://nltk.sourceforge.net/) under Python (my version is 2.1.1)?

problems:
first, I wanted to import a module, as it is written in the manual, but
it didn't work:
from nltk.token import * Traceback (most recent calls last):
File "<stdin>", line 1, in ?
ImportError: No module named nltk.token

since there was such module I thought that Python simply didn't look for
it in the right directory and I rewrote the path:

import sys, os
SRCDIR="/home/name/nltk-1.3"
sys.path.append(SRCDIR)
print sys.path

After that the error message changed to:
from nltk.token import *

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "__init__.py", line 49, in ?
----------------
File "/...........python211/lib/python2.1/lib-tk/Tkinter.py", line
35, in ?
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: libtk8.3.so: cannot open shared object file: No such file
or directory

Then I typed import _tkinter but it didn't help, I got the same error
message as before:

File "/...........python211/lib/python2.1/lib-tk/Tkinter.py", line
35, in ?
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: libtk8.3.so: cannot open shared object file: No such file
or directory

If I try to import the module again I get:

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/home/name/nltk-1.3/nltk/token.py", line 308
yield self._deep_restrict(item, props, incl)
^
SyntaxError: invalid syntax

Does it really mean that Python is not configured for Tk? What does
"<stdin>" mean? Is it the problem with nltk rather than with Python?

thanx in advance,
Katja
Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.