Hi, everyone.
I'm new to PA and trying to figure out how this works. Please excuse my ignorance because I suspect this is a basic question.
If I start up a Python shell, I can use NLTK with no trouble. Specifically, I did
import nltk
ntlk.download()
from nltk.book import *
text1.concordance("monstrous")
At the download step, I chose the "book" option for everything that goes with the NLTK book. This approach worked fine.
Now, moving over to a file, I'm trying to do the same thing but contained within nltk.py rather than from the python shell. So something like
import nltk
fname = raw_input('Enter file name: ')
fh = open(fname)
print fh.concordance("the")
But this method doesn't seem to connect to the NLTK commands, and I also don't know how to point it to the texts (text1, text2, etc.) that were downloaded with the first approach.
Any help would be much appreciated!