nltk.app.chunkparser() not working in python3 and nltk3

121 views
Skip to first unread message

Antonio Guerrieri

unread,
Feb 27, 2015, 1:32:43 PM2/27/15
to nltk-...@googlegroups.com
Hi all,
nltk.app.chunkparser() doesn't work in python3 with nltk3 while it works with python2 and nltk2.
The most frequent error returned is:

> Exception in Tkinter callback
> Traceback (most recent call last):
> File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 1533, in __call__
> return self.func(*args)
> File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/nltk/app/chunkparser_app.py", line 1072, in update
> for line in normalized_grammar.split('\n')]
> File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/nltk/app/chunkparser_app.py", line 1072, in <listcomp>
> for line in normalized_grammar.split('\n')]
> AttributeError: type object 'RegexpChunkRule' has no attribute 'parse'

Can you check if it happens to you also?

Tx

Antonio

Richard Lane

unread,
Mar 12, 2015, 6:48:18 AM3/12/15
to nltk-...@googlegroups.com
I get the same error using Python 3.4.3 and NLTK 3.0.1 on Windows. I haven't yet found a solution.

Andy Wickham

unread,
Apr 10, 2015, 3:02:48 AM4/10/15
to nltk-...@googlegroups.com
I'm getting the same thing on Python 2.7 and NLTK 3.0.1 (also on Windows)... Did you guys have any luck fixing it?

Vardaan Bhat

unread,
Apr 10, 2015, 3:05:19 AM4/10/15
to nltk-...@googlegroups.com
I had the same error a while back. I think you would be well served getting an earlier python + nltk. Also, from mentors, I feel that nltk 2 is better built for the time being (e.g. more support and packages) as opposed to nltk 3.


Antonio

--
You received this message because you are subscribed to the Google Groups "nltk-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nltk-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Vardaan Bhat

Antonio Guerrieri

unread,
Apr 10, 2015, 3:52:06 AM4/10/15
to nltk-...@googlegroups.com
I solved installing the develop version (https://github.com/nltk/nltk/archive/develop.zip) as suggested by Prof. Steven Bird one month ago.
Can you give a try? Hope this helps.
Regards

Alexis Dimitriadis

unread,
Apr 10, 2015, 4:48:18 AM4/10/15
to nltk-...@googlegroups.com
The method parse() has been renamed to `fromstring() all over the nltk. 

Best,

Alexis

Dr. Alexis Dimitriadis | Assistant Professor and Senior Research Fellow | Utrecht Institute of Linguistics OTS | Utrecht University | Trans 10, 3512 JK Utrecht, room 2.33 | +31 30 253 65 68 | a.dimi...@uu.nl | www.hum.uu.nl/medewerkers/a.dimitriadis

Alexis Dimitriadis

unread,
Apr 10, 2015, 5:06:33 PM4/10/15
to nltk-...@googlegroups.com
I need to install a subset of nltk_data at a central location for classroom use. Can an nltk_data folder extracted on OS X be used transparently under Windows, or vice versa? I expect the corpora will be ok, but what about saved models for things like sentence tokenization, POS tagging, etc.? The models we'll need are all part of the "book" bundle, I believe. 

I can imagine some pickled structures containing references to OS-specific functions, for example, or some artifacts of the downloading being created in an OS-dependent way. Does anyone have experience with this?

Steven Bird

unread,
Apr 10, 2015, 5:26:15 PM4/10/15
to nltk-...@googlegroups.com
Hi Alexis,

I've never experienced problems when distributing CDs or USB sticks containing NLTK corpora for students using a variety of platforms. I believe that Python pickle files are fully OS-independent.

-Steven


Reply all
Reply to author
Forward
0 new messages