Dwnnis
Dwnnis

Reputation: 13

Python nltk ImportError

I was trying to use nltk for python and then confronted with this problem.

>>>from nltk.corpus import sinica_tree

and then the error occured:

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

I've checked that nltk is installed and that sinica_tree is also installed using nltk.download(). Need some help for this.

Upvotes: 1

Views: 1201

Answers (2)

Gihan Chathuranga
Gihan Chathuranga

Reputation: 448

>>>import nltk
>>>nltk.download()
---------------------------------------------------------------------------
    d) Download   l) List    u) Update   c) Config   h) Help   q) Quit
---------------------------------------------------------------------------
Downloader> d

Download which package (l=list; x=cancel)?
  Identifier> treebank

then try to import

from nltk.corpus import sinica_treebank

Upvotes: 0

dursk
dursk

Reputation: 4445

According to the documentation it looks like it should be:

from nltk.corpus import sinica_treebank

See: http://www.nltk.org/nltk_data/

Upvotes: 1

Related Questions