I'm trying to get output from NLTK to print to the browser, but can't seem to get the output there.
I have tested the core function in the Python shell, so I know that works.
Any ideas on how to get the output printed out?
The routing seems to work fine, and am pretty sure things work until the last call.
Here's the function from Django's views.py:
def concordance(request):
script = request.GET.get('script')
textPath = '[path to dir]'
fullTextPath = textPath+script+'.txt'
f=open(fullTextPath)
raw=f.read()
tokens = nltk.word_tokenize(raw)
text = nltk.Text(tokens)
result = text.concordance('love')
return HttpResponse(result, content_type="text/html")