index
module components.slinket.main
EventExpression
Slinket
Main module for the Slinket component.
Responsible for the top-level processing of Slinket. Most functionality is in
the Chunk class.
class EventExpression
Inherits from: object
Class that wraps an event in a way that's convenient for Slinket.
Instance variables:
dict - dictionary of event attributes
eid
eiid
tense
aspect
nf_morph - VERB, NOUN or ADJECTIVE, sometimes called epos
polarity - optional attribute (that is, it can be None)
modality - optional attribute (that is, it can be None)
evClass - the event class
pos - the part-of-speech of the event token
form - the actual string
locInSent - idx of node bearing event tag in the document, wrt to its
sentence parent node.
eventNum - position of event in sentence.eventList (needed for
potential slinking with previous or next events in list)
Public Functions
__init__(self, eid, locInSent, eventNum, event_attributes)
Set all attributes, using default values if appropriate. The arguments are:
an identifier string, an integer reflecting the location of the event in
the sentence, an integer reflecting the position of the event on the
eventList on the sentence and a dictionary with event attributes.
alinkingContexts(self, key)
Returns the list of alink patterns from the dictionary.
as_verbose_string(self)
can_introduce_alink(self)
Returns True if the EventExpression instance can introduce an Alink, False
otherwise. This ability is determined by dictionary lookup.
can_introduce_slink(self)
Returns True if the EventExpression instance can introduce an Slink, False
otherwise. This ability is determined by dictionary lookup.
get_event_attribute(self, attr, optional=False)
Return the value of an attribute 'attr' from self.dict. If the attribute is
not in the dictionary, then (i) return a default value if there is one,
and (ii) write an error if the attribute is not optional.
pp(self)
pretty_print(self)
slinkingContexts(self, key)
Returns the list of slink patterns from the dictionary.
class Slinket
Inherits from: TarsqiComponent
Class that implements the Slinket SLINK and ALINK parser. Only lexical alinks
and slinks are found.
Purpose clause are not yet implemented. But note that some purpose clause
SLINKS are already introduced in the lexically-triggered process. This is so
for those events that discoursively tend to appear modified by a Purpose
Clause (e.g., 'address'). The data are based on TimeBank. Conditionals are
not implemented either.
Instance variables:
NAME - a string
doctree - a TarsqiTree
docelement - a docelement Tag
Public Functions
__init__(self)
Initialize Slinket. Sets doctree and docelement to None, these are added by
process_doctree().
process_doctree(self, doctree)
Find alinks and slinks in doctree and export them to self.docelement.
Private Functions
_add_link(self, tagname, attrs)
Add the link to the TagRepository instance on the TarsqiDocument.
_add_links_to_document(self)
_build_event_dictionary(self)
Creates a dictionary with events on the self.doctree variable and adds
event lists (which consist of pairs of event location and event id) to
all sentences in self.doctree.
_find_alink(self, sentence, event_expr)
Try to find an alink with event_expr as the trigger, alinks are created as a side
effect.
_find_lexically_based_slink(self, sentence, event_expr)
Try to find lexically based Slinks for an instance of EventExpression using
forward, backward and reporting FSA paterns. No return value, if an
Slink is found, it will be created by the chunk that embeds the Slink
triggering event.
_find_links(self, doc, sentence)
For each event in the sentence, check whether an Alink or Slink can be
created for it.