nltk.corpus.reader.verbnet module

An NLTK interface to the VerbNet verb lexicon

For details about VerbNet see: https://verbs.colorado.edu/~mpalmer/projects/verbnet.html

class nltk.corpus.reader.verbnet.VerbnetCorpusReader[source]

Bases: nltk.corpus.reader.xmldocs.XMLCorpusReader

An NLTK interface to the VerbNet verb lexicon.

From the VerbNet site: “VerbNet (VN) (Kipper-Schuler 2006) is the largest on-line verb lexicon currently available for English. It is a hierarchical domain-independent, broad-coverage verb lexicon with mappings to other lexical resources such as WordNet (Miller, 1990; Fellbaum, 1998), XTAG (XTAG Research Group, 2001), and FrameNet (Baker et al., 1998).”

For details about VerbNet see: https://verbs.colorado.edu/~mpalmer/projects/verbnet.html

__init__(root, fileids, wrap_etree=False)[source]
Parameters
  • root (PathPointer or str) – A path pointer identifying the root directory for this corpus. If a string is specified, then it will be converted to a PathPointer automatically.

  • fileids – A list of the files that make up this corpus. This list can either be specified explicitly, as a list of strings; or implicitly, as a regular expression over file paths. The absolute path for each file will be constructed by joining the reader’s root to each file name.

  • encoding

    The default unicode encoding for the files that make up the corpus. The value of encoding can be any of the following:

    • A string: encoding is the encoding name for all files.

    • A dictionary: encoding[file_id] is the encoding name for the file whose identifier is file_id. If file_id is not in encoding, then the file contents will be processed using non-unicode byte strings.

    • A list: encoding should be a list of (regexp, encoding) tuples. The encoding for a file whose identifier is file_id will be the encoding value for the first tuple whose regexp matches the file_id. If no tuple’s regexp matches the file_id, the file contents will be processed using non-unicode byte strings.

    • None: the file contents of all files will be processed using non-unicode byte strings.

  • tagset – The name of the tagset used by this corpus, to be used for normalizing or converting the POS tags returned by the tagged_...() methods.

lemmas(vnclass=None)[source]

Return a list of all verb lemmas that appear in any class, or in the classid if specified.

wordnetids(vnclass=None)[source]

Return a list of all wordnet identifiers that appear in any class, or in classid if specified.

classids(lemma=None, wordnetid=None, fileid=None, classid=None)[source]

Return a list of the VerbNet class identifiers. If a file identifier is specified, then return only the VerbNet class identifiers for classes (and subclasses) defined by that file. If a lemma is specified, then return only VerbNet class identifiers for classes that contain that lemma as a member. If a wordnetid is specified, then return only identifiers for classes that contain that wordnetid as a member. If a classid is specified, then return only identifiers for subclasses of the specified VerbNet class. If nothing is specified, return all classids within VerbNet

vnclass(fileid_or_classid)[source]

Returns VerbNet class ElementTree

Return an ElementTree containing the xml for the specified VerbNet class.

Parameters

fileid_or_classid – An identifier specifying which class should be returned. Can be a file identifier (such as 'put-9.1.xml'), or a VerbNet class identifier (such as 'put-9.1') or a short VerbNet class identifier (such as '9.1').

fileids(vnclass_ids=None)[source]

Return a list of fileids that make up this corpus. If vnclass_ids is specified, then return the fileids that make up the specified VerbNet class(es).

frames(vnclass)[source]

Given a VerbNet class, this method returns VerbNet frames

The members returned are: 1) Example 2) Description 3) Syntax 4) Semantics

Parameters

vnclass – A VerbNet class identifier; or an ElementTree containing the xml contents of a VerbNet class.

Returns

frames - a list of frame dictionaries

subclasses(vnclass)[source]

Returns subclass ids, if any exist

Given a VerbNet class, this method returns subclass ids (if they exist) in a list of strings.

Parameters

vnclass – A VerbNet class identifier; or an ElementTree containing the xml contents of a VerbNet class.

Returns

list of subclasses

themroles(vnclass)[source]

Returns thematic roles participating in a VerbNet class

Members returned as part of roles are- 1) Type 2) Modifiers

Parameters

vnclass – A VerbNet class identifier; or an ElementTree containing the xml contents of a VerbNet class.

Returns

themroles: A list of thematic roles in the VerbNet class

longid(shortid)[source]

Returns longid of a VerbNet class

Given a short VerbNet class identifier (eg ‘37.10’), map it to a long id (eg ‘confess-37.10’). If shortid is already a long id, then return it as-is

shortid(longid)[source]

Returns shortid of a VerbNet class

Given a long VerbNet class identifier (eg ‘confess-37.10’), map it to a short id (eg ‘37.10’). If longid is already a short id, then return it as-is.

pprint(vnclass)[source]

Returns pretty printed version of a VerbNet class

Return a string containing a pretty-printed representation of the given VerbNet class.

Parameters

vnclass – A VerbNet class identifier; or an ElementTree containing the xml contents of a VerbNet class.

pprint_subclasses(vnclass, indent='')[source]

Returns pretty printed version of subclasses of VerbNet class

Return a string containing a pretty-printed representation of the given VerbNet class’s subclasses.

Parameters

vnclass – A VerbNet class identifier; or an ElementTree containing the xml contents of a VerbNet class.

pprint_members(vnclass, indent='')[source]

Returns pretty printed version of members in a VerbNet class

Return a string containing a pretty-printed representation of the given VerbNet class’s member verbs.

Parameters

vnclass – A VerbNet class identifier; or an ElementTree containing the xml contents of a VerbNet class.

pprint_themroles(vnclass, indent='')[source]

Returns pretty printed version of thematic roles in a VerbNet class

Return a string containing a pretty-printed representation of the given VerbNet class’s thematic roles.

Parameters

vnclass – A VerbNet class identifier; or an ElementTree containing the xml contents of a VerbNet class.

pprint_frames(vnclass, indent='')[source]

Returns pretty version of all frames in a VerbNet class

Return a string containing a pretty-printed representation of the list of frames within the VerbNet class.

Parameters

vnclass – A VerbNet class identifier; or an ElementTree containing the xml contents of a VerbNet class.