Verbnet not loaded yet?

47 views
Skip to first unread message

max77

unread,
Jul 20, 2017, 4:26:53 PM7/20/17
to nltk-users
Hello all,

I am on the last page of the second chapter of the NLTK Book. On page 73 theres a try me now about verbnet. I tried but are unable to access it. 

>>> nltk.corpus.verbnet
<VerbnetCorpusReader in u'.../corpora/verbnet' (not loaded yet)>

Is there any reason as to why?


max77

unread,
Jul 24, 2017, 10:30:38 AM7/24/17
to nltk-users
Can someone please help me out?

Dimitriadis, A. (Alexis)

unread,
Jul 24, 2017, 10:38:14 AM7/24/17
to nltk-...@googlegroups.com
Hi Max,

What problem exactly do you have? I can only answer your “why” question: The nltk comes with about a hundred corpora, almost none of which will you use in a given session (and most of which you will never use.) The corpora are provided as stubs through the “LazyLoader” class. When you try to actually use them, they will be transparently loaded for you. (Or just call the .ensure_loaded() method). 

You’ll also need to download the verbnet data using `nltk.download()`, if you haven’t done so yet. Then just go on to use the corpus.

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

--
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.

max77

unread,
Jul 24, 2017, 11:22:40 AM7/24/17
to nltk-users
Hello Alexis,

Thanks for writing. It is more of a confusion than anything. I worked all the way through chapter 2 of the NLTK book with no problems following the content. On page 73 though, there is tip that says that verbnet can be accessed with the code:

>>>nltk.corpus.verbnet()

Except, when I run this it throws this strange error:

<VerbnetCorpusReader in u'.../corpora/verbnet' (not loaded yet)>

I did in fact download verbnet because I checked several times and I checked the documentation for verbnet. So this is where I am stuck. 

-Max

Dimitriadis, A. (Alexis)

unread,
Jul 24, 2017, 11:30:26 AM7/24/17
to nltk-...@googlegroups.com
That’s not an error, it’s a text representation of the unloaded corpus object. (And you’re clearly typing nltk.corpus.verbnet, without the parens; otherwise you’d really be getting an error). 

Just use it like any other nltk corpus: Import it, then find out what methods it has and use them. (If the documentation you read didn’t do it, try `help(nltk.corpus.verbnet)`. 

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

max77

unread,
Jul 24, 2017, 11:47:33 AM7/24/17
to nltk-users
Update: 

I can run all the code on:

So it's probably nothing that I have to worry about. I guess I was more curious about the message than anything. Anyways, I will probably move on to the exercises. 

-Thanks for your help Alexis! :)
Reply all
Reply to author
Forward
0 new messages