index
module components.s2t.main
Alink
Slink
Slink2Tlink
Main module for the S2T component.
Responsible for the top-level processing of S2T. It contains Slink2Tlink, which
inherits from TarsqiComponent as well as Slink, a class that takes care of
applying s2t-rules to each SLINK.
class Alink
Inherits from: object
Public Functions
__init__(self, xmldoc, doctree, alinkTag)
apply_patterns(self)
Loop through TLINKs to match A2T pattern
createTlink(self, tlink, patternNum)
is_a2t_candidate(self)
lookForAtlinks(self)
Examine whether the Alink can generate a Tlink.
class Slink
Inherits from: object
Implements the Slink object. An Slink object consists of the attributes
of the SLINK (relType, eventInstanceID, and subordinatedEventInstance) and
the attributes of the specific event instances involved in the link.
Instance variables:
doctree - a TarsqiTree
attrs - adictionary containing the attributes of the slink
eventInstance - an InstanceTag
subEventInstance - an InstanceTag
Public Functions
__init__(self, doctree, instances, slinkTag)
Initialize an Slink using an XMLDocument, a dictionary of instances
and the slink element from xmldoc.
__str__(self)
create_tlink(self, rule)
Takes an S2T rule object and calls the add_tlink method from xmldoc
to create a new TLINK using the appropriate SLINK event instance IDs and
the relation attribute of the S2T rule.
match(self, rule)
The match method applies an S2TRule object to an the Slink. It
returns the rule if the Slink is a match, False otherwise.
match_rules(self, rules)
Match all the rules in the rules argument to the SLINK. If a rule
matches, this method creates a TLINK and breaks out of the loop.
class Slink2Tlink
Inherits from: TarsqiComponent
Implements the S2T component of Tarsqi. S2T takes the output of Slinket
and applies rules to the Slinks to create new Tlinks.
Public Functions
__init__(self)
Set component name and load rules into an S2TRuleDictionary object.
process_doctree(self, doctree)
Apply all S2T rules to doctree.
Private Functions
_add_links_to_tarsqidoc(self)
Export the links from the TarsqiTree to the TagRepository instance on
the TarsqiDocument. We do this because the match code inserts into the
tarsqi tree, but we may want to revisit this and do it the same way as
Blinker, which adds directly to the TarsqiDocument.