module documentation

Corpus reader for the FrameNet 1.7 lexicon and corpus.

Class AttrDict A class that wraps a dict and allows accessing the keys of the dict as if they were attributes. Taken from here: http://stackoverflow.com/a/14620633/8879
Class Future Wraps and acts as a proxy for a value to be loaded lazily (on demand). Adapted from https://gist.github.com/sergey-miryanov/2935416
Class PrettyDict Displays an abbreviated repr of values where possible. Inherits from AttrDict, so a callable value will be lazily converted to an actual value.
Class PrettyLazyConcatenation Displays an abbreviated repr of only the first several elements, not the whole list.
Class PrettyLazyIteratorList Displays an abbreviated repr of only the first several elements, not the whole list.
Class PrettyLazyMap Displays an abbreviated repr of only the first several elements, not the whole list.
Class PrettyList Displays an abbreviated repr of only the first several elements, not the whole list.
Class SpecialList A list subclass which adds a '_type' attribute for special printing (similar to an AttrDict, though this is NOT an AttrDict subclass).
Exception FramenetError An exception class for framenet-related errors.
Function demo Undocumented
Function mimic_wrap Wrap the first of 'lines' with textwrap and the remaining lines at exactly the same positions as the first.
Function _annotation_ascii Given a sentence or FE annotation set, construct the width-limited string showing an ASCII visualization of the sentence's annotations, calling either _annotation_ascii_frames() or _annotation_ascii_FEs() as appropriate...
Function _annotation_ascii_FE_layer Helper for _annotation_ascii_FEs().
Function _annotation_ascii_FEs ASCII string rendering of the sentence along with a single target and its FEs. Secondary and tertiary FE layers are included if present. 'sent' can be an FE annotation set or an LU sentence with a single target...
Function _annotation_ascii_frames ASCII string rendering of the sentence along with its targets and frame names. Called for all full-text sentences, as well as the few LU sentences with multiple targets (e.g., fn.lu(6412).exemplars[82] has two want...
Function _pretty_annotation Helper function for pretty-printing an exemplar sentence for a lexical unit.
Function _pretty_any Helper function for pretty-printing any AttrDict object.
Function _pretty_exemplars Helper function for pretty-printing a list of exemplar sentences for a lexical unit.
Function _pretty_fe Helper function for pretty-printing a frame element.
Function _pretty_fe_relation Helper function for pretty-printing an FE relation.
Function _pretty_frame Helper function for pretty-printing a frame.
Function _pretty_frame_relation Helper function for pretty-printing a frame relation.
Function _pretty_frame_relation_type Helper function for pretty-printing a frame relation type.
Function _pretty_fulltext_sentence Helper function for pretty-printing an annotated sentence from a full-text document.
Function _pretty_fulltext_sentences Helper function for pretty-printing a list of annotated sentences for a full-text document.
Function _pretty_longstring Helper function for pretty-printing a long string.
Function _pretty_lu Helper function for pretty-printing a lexical unit.
Function _pretty_pos Helper function for pretty-printing a sentence with its POS tags.
Function _pretty_semtype Helper function for pretty-printing a semantic type.
def demo(): (source)

Undocumented

def mimic_wrap(lines, wrap_at=65, **kwargs): (source)

Wrap the first of 'lines' with textwrap and the remaining lines at exactly the same positions as the first.

def _annotation_ascii(sent): (source)

Given a sentence or FE annotation set, construct the width-limited string showing an ASCII visualization of the sentence's annotations, calling either _annotation_ascii_frames() or _annotation_ascii_FEs() as appropriate. This will be attached as a method to appropriate AttrDict instances and called in the full pretty-printing of the instance.

def _annotation_ascii_FE_layer(overt, ni, feAbbrevs): (source)

Helper for _annotation_ascii_FEs().

def _annotation_ascii_FEs(sent): (source)

ASCII string rendering of the sentence along with a single target and its FEs. Secondary and tertiary FE layers are included if present. 'sent' can be an FE annotation set or an LU sentence with a single target. Line-wrapped to limit the display width.

def _annotation_ascii_frames(sent): (source)

ASCII string rendering of the sentence along with its targets and frame names. Called for all full-text sentences, as well as the few LU sentences with multiple targets (e.g., fn.lu(6412).exemplars[82] has two want.v targets). Line-wrapped to limit the display width.

def _pretty_annotation(sent, aset_level=False): (source)

Helper function for pretty-printing an exemplar sentence for a lexical unit.

:param sent: An annotation set or exemplar sentence to be printed. :param aset_level: If True, 'sent' is actually an annotation set within a sentence. :type sent: AttrDict :return: A nicely formated string representation of the exemplar sentence with its target, frame, and FE annotations. :rtype: str

def _pretty_any(obj): (source)

Helper function for pretty-printing any AttrDict object.

:param obj: The obj to be printed. :type obj: AttrDict :return: A nicely formated string representation of the AttrDict object. :rtype: str

def _pretty_exemplars(exemplars, lu): (source)

Helper function for pretty-printing a list of exemplar sentences for a lexical unit.

:param sent: The list of exemplar sentences to be printed. :type sent: list(AttrDict) :return: An index of the text of the exemplar sentences. :rtype: str

def _pretty_fe(fe): (source)

Helper function for pretty-printing a frame element.

:param fe: The frame element to be printed. :type fe: AttrDict :return: A nicely formated string representation of the frame element. :rtype: str

def _pretty_fe_relation(ferel): (source)

Helper function for pretty-printing an FE relation.

:param ferel: The FE relation to be printed. :type ferel: AttrDict :return: A nicely formated string representation of the FE relation. :rtype: str

def _pretty_frame(frame): (source)

Helper function for pretty-printing a frame.

:param frame: The frame to be printed. :type frame: AttrDict :return: A nicely formated string representation of the frame. :rtype: str

def _pretty_frame_relation(frel): (source)

Helper function for pretty-printing a frame relation.

:param frel: The frame relation to be printed. :type frel: AttrDict :return: A nicely formated string representation of the frame relation. :rtype: str

def _pretty_frame_relation_type(freltyp): (source)

Helper function for pretty-printing a frame relation type.

:param freltyp: The frame relation type to be printed. :type freltyp: AttrDict :return: A nicely formated string representation of the frame relation type. :rtype: str

def _pretty_fulltext_sentence(sent): (source)

Helper function for pretty-printing an annotated sentence from a full-text document.

:param sent: The sentence to be printed. :type sent: list(AttrDict) :return: The text of the sentence with annotation set indices on frame targets. :rtype: str

def _pretty_fulltext_sentences(sents): (source)

Helper function for pretty-printing a list of annotated sentences for a full-text document.

:param sent: The list of sentences to be printed. :type sent: list(AttrDict) :return: An index of the text of the sentences. :rtype: str

def _pretty_longstring(defstr, prefix='', wrap_at=65): (source)

Helper function for pretty-printing a long string.

:param defstr: The string to be printed. :type defstr: str :return: A nicely formated string representation of the long string. :rtype: str

def _pretty_lu(lu): (source)

Helper function for pretty-printing a lexical unit.

:param lu: The lu to be printed. :type lu: AttrDict :return: A nicely formated string representation of the lexical unit. :rtype: str

def _pretty_pos(aset): (source)

Helper function for pretty-printing a sentence with its POS tags.

:param aset: The POS annotation set of the sentence to be printed. :type sent: list(AttrDict) :return: The text of the sentence and its POS tags. :rtype: str

def _pretty_semtype(st): (source)

Helper function for pretty-printing a semantic type.

:param st: The semantic type to be printed. :type st: AttrDict :return: A nicely formated string representation of the semantic type. :rtype: str