Updated answer:NLTK works for 2.7 well. I had 3.2. I uninstalled 3.2 and installed 2.7. Now it works!!
I have installed NLTK and tried to download NLTK Data. What I did was to follow the instrution on this site: http://www.nltk.org/data.html
I downloaded NLTK, installed it, and then tried to run the following code:
>>> import nltk
>>> nltk.download()
It gave me the error message like below:
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
nltk.download()
AttributeError: 'module' object has no attribute 'download'
Directory of C:\Python32\Lib\site-packages
Tried both nltk.download()
and nltk.downloader()
, both gave me error messages.
Then I used help(nltk)
to pull out the package, it shows the following info:
NAME
nltk
PACKAGE CONTENTS
align
app (package)
book
ccg (package)
chat (package)
chunk (package)
classify (package)
cluster (package)
collocations
corpus (package)
data
decorators
downloader
draw (package)
examples (package)
featstruct
grammar
help
inference (package)
internals
lazyimport
metrics (package)
misc (package)
model (package)
parse (package)
probability
sem (package)
sourcedstring
stem (package)
tag (package)
test (package)
text
tokenize (package)
toolbox
tree
treetransforms
util
yamltags
FILE
c:\python32\lib\site-packages\nltk
I do see Downloader there, not sure why it does not work. Python 3.2.2, system Windows vista.
you can't have a saved python file called
nltk.py
because the interpreter is reading from that and not from the actual file.Change the name of your file that the python shell is reading from and try what you were doing originally:
import nltk
and thennltk.download()
I had the similar issue. Probably check if you are using proxy.
If yes, set up the proxy before doing download:
You may try:
happy nlp'ing.
Please Try
After running this you get something like this
Then,
Press d
Do As Follows:
You will get following message on completion, and Prompt then
Press q
Done downloading collection allInstall Pip: run in terminal : sudo easy_install pip
Install Numpy (optional): run : sudo pip install -U numpy
Install NLTK: run : sudo pip install -U nltk
Test installation: run: python
then type : import nltk
To download the corpus
run : python -m nltk.downloader all
It's very simple....