How do you use the Unified Verb Index in Python?

512 views Asked by At

I know that nltk contains the VerbNet corpus, however, the Unified Verb Index combines information from it and 3 other useful sources. Is there any way to use this corpus in Python?

1

There are 1 answers

0
maxdh On

Through NLTK you can certainly access FrameNet, VerbNet and PropBank. I haven't done any work with the OntoNotes Sense Groupings.

Look at the below for an idea of how to get information out of these three resources. Each of them returns a list so you can grab list elements individually and examine them in however much detail you need.

from nltk.corpus import verbnet as vn
from nltk.corpus import framenet as fn
from nltk.corpus import propbank as pb

input = 'take'

vn_results = vn.classids(lemma=input)

if not vn_results:
    print input + ' not in verbnet.'
else:
    print 'verbnet:'
    print vn_results

fn_results = fn.frames_by_lemma(input)

if not fn_results:
    print input + ' not in framenet.'
else:
    print 'framenet:'
    print fn_results

pb_results = []
try:
    pb_results = pb.rolesets(input)
except ValueError:
    print input + ' not in propbank.'

if pb_results:
    print 'propbank:'
    print pb_results