0

I am very new at programming, so the following question may seem trivial. I'm currently using Python 3.4.1 with the sublime text editor (3).Since I want to use nltk, I downloaded it and I installed it succesfully. When I try to import nltk, it gives me no errors. However, whenever I want to import a corpus (e.g. Brown corpus) I get the following error: "

Traceback (most recent call last):
  File "C:\Users\XXX\Desktop\pythontest.py", line 1, in <module>
    from nltk import brown
ImportError: cannot import name 'brown'
[Finished in 0.8s with exit code 1]
[shell_cmd: python -u "C:\Users\XXX\Desktop\pythontest.py"]
[dir: C:\Users\Xxx\Desktop]
[path: C:\Python34\;C:\Python34\Scripts;c:\Program Files (x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;$env:APPDATA\Python\Scripts]

"

I did install the corpora with the function nltk.download() succesfully. I seem to have problems with my python path, even though I have read about it on the internet and tried a few things, I can't seem to make it work. I'm not a mac user by the way.

Can anyone help me by telling me step by step how I can adjust my nltk to the correct python file?

Thanks in advance!

1 Answer 1

2

I think you want

from nltk.corpus import brown

Notice the corpus namespace.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.