adstrumm_
adstrumm_

Reputation: 71

How to access nltk in pycharm?

I downloaded the nltk (book) using the code: import nltk nltk.download()

however when I try to test the nltk data using the below code, it won't work: from nltk.corpus import brown brown.words()

the code and output

Upvotes: 0

Views: 1279

Answers (1)

Kyle F. Hartzenberg
Kyle F. Hartzenberg

Reputation: 3730

In the NLTK Window, navigate to the "Corpora" tab and check that brown has been installed. It should be highlighted green with status set to "installed" (see image below). Next check that you can find the unzipped brown folder in C:\Users\User\AppData\Roaming\nltk_data. Finally, assuming everything is present and working (i.e. you're not receiving any errors) when running the code, you will not be seeing any output in PyCharm without calling print. Instead, try this:

import nltk
from nltk.corpus import brown
nltk.download()
print(brown.words())

# Output
>>> ['The', 'Fulton', 'County', 'Grand', 'Jury', 'said', ...]

NLTK Downloader Window

Upvotes: 1

Related Questions