nltk/nltk — Issue #82: Loading corpora in concordance and collocations tools
Author: alexrudnick
Created: 2012-01-17 06:25:40+00:00
State: open

What steps will reproduce the problem?

>>> nltk.app.concordance()

and

>>> nltk.app.collocations()

What is the expected output? What do you see instead?

out of stack space (infinite loop?)
Exception in thread English: Brown Corpus (Learned, simplified):
Traceback (most recent call last):
File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py",
line 525, in __bootstrap_inner
self.run()
...
TclError: out of stack space (infinite loop?)

Migrated from http://code.google.com/p/nltk/issues/detail?id=445

earlier comments

sumukh.ghodke said, at 2009-09-19T02:06:59.000Z:

I tested the latest nltk build on ubuntu 9.04 (python 2.6.2; Tcl/Tk 8.5.6) and Mac
OsX 10.5.8 (python 2.5.2; Tcl/Tk 8.4.7), but didn't encounter the above error.

This problem seems to happen during Tkinter initialisation from python code. Some say
that it occurs when Tcl/Tk is built without a parameter called --enable-threads.
[ref:http://bugs.python.org/issue3835] Can you please check if this happens even
after you recompile Tcl/Tk?

Some background on why threads are used in the concordance app:
The concordance app uses a Model-View architecture. the view is loaded using python's
mainloop thread, whereas data loading and search operations take place in independent
threads. In order to make sure that gui rendering always happen in the mainloop
thread I fire events from the data loading threads. The mainloop thread should be
informed of those events and accordingly render results.
This bug wouldn't have occurred if it was single threaded, but then the app would
have been less responsive too. If really required we could make it run in a single
thread.