My nltk data is ~/nltk_data/corpora/words/(en,en-basic,README)
According to __init__.py inside ~/lib/python2.7/site-packages/nltk/corpus, to read a list of the words in the Brown Corpus, use
nltk.corpus.brown.words():
from nltk.corpus import brown
print brown.words()
['The', 'Fulton', 'County', 'Grand', 'Jury', 'said', ...]
This __init__.py has
words = LazyCorpusLoader(
'words', WordListCorpusReader, r'(?!README|\.).*')
So when I write
from nltk.corpus import words, am I importing the 'words' function from__init__.pywhich resides in directorypython2.7/site-packages/nltk/corpus?Also why does this happen:
import nltk.corpus.words ImportError: No module named words from nltk.copus import words # WORKS FINEThe "brown" corpus resides inside
~/nltk_data/corpora(and not in nltk/corpus). So why does this command work?from nltk.corpus import brownShouldn't it be this?
from nltk_data.corpora import brown