index
module components.classifier.vectors
ContextFeatures
ContextFeaturesET
EEVector
ETVector
EventVector
PairVector
TimexVector
Vector
This module is responsible for creating the vectors that are input to the
mallet trainer and classifier.
If input is created for the classifier then it looks like
wsj_0006.tml-ei80-ei81 None e1-asp=NONE e1-class=ASPECTUAL e1-epos=None
e1-mod=NONE e1-pol=POS e1-stem=None e1-str=complete e1-tag=EVENT
e1-ten=PRESENT e2-asp=NONE e2-class=OCCURRENCE e2-epos=None e2-mod=NONE
e2-pol=POS e2-stem=None e2-str=transaction e2-tag=EVENT e2-ten=NONE shAsp=0
shTen=1
If input is created for model building then it looks like
wsj_0006.tml-ei80-ei81 ENDS e1-asp=NONE e1-class=ASPECTUAL e1-epos=None
e1-mod=NONE e1-pol=POS e1-stem=None e1-str=complete e1-tag=EVENT
e1-ten=PRESENT e2-asp=NONE e2-class=OCCURRENCE e2-epos=None e2-mod=NONE
e2-pol=POS e2-stem=None e2-str=transaction e2-tag=EVENT e2-ten=NONE shAsp=0
shTen=1
The only difference is in the second column (no relation versus a relation).
class ContextFeatures
Inherits from: object
Implements the code to retrieve the context features of two vectors in
the same sentence.
Public Functions
__init__(self, tarsqidoc, v1, v2)
get(self, feature)
items(self)
Private Functions
_setup_auxiliary_data(self)
Extracts the position in the tokens list of the two objects.
class ContextFeaturesET
Inherits from: ContextFeatures
Implements the code to retrieve the context features of two vectors in
the same sentence.
Public Functions
__init__(self, tarsqidoc, v1, v2)
Private Functions
_set_feature_ORDER(self)
Binary feature depending on the order of the event and timex.
_set_feature_SIGNAL(self)
The intervening preposition.
class EEVector
Inherits from: PairVector
Class responsible for creating the vector between two events. Uses the
vector of each event and adds extra features. The result looks like:
wsj_0006.tml-ei80-ei81 UNKNOWN e1-asp=NONE e1-cls=ASPECTUAL
e1-epos=None e1-mod=NONE e1-pol=POS e1-stem=None e1-str=complete
e1-tag=EVENT e1-ten=PRESENT e2-asp=NONE e2-cls=OCCURRENCE e2-epos=None
e2-mod=NONE e2-pol=POS e2-stem=None e2-str=transaction e2-tag=EVENT
e2-ten=NONE shAsp=0 shTen=1
Public Functions
__init__(self, tarsqidoc, event_vector1, event_vector2)
class ETVector
Inherits from: PairVector
Class responsible for creating the vector between an event and a
time. Uses the event and time vectors and adds extra features. The result
looks like:
NYT19980402.0453.tml-ei2264-t61 IS_INCLUDED e-asp=NONE e-cls=OCCURRENCE
e-epos=None e-mod=NONE e-pol=POS e-stem=None e-str=created e-tag=EVENT
e-ten=PAST t-str=Tuesday t-tag=TIMEX3 t-type=DATE t-value=1998-03-31
order=et sig=on
Public Functions
__init__(self, tarsqidoc, event_vector, timex_vector)
class EventVector
Inherits from: Vector
Implements a vector with internal features of the event tag.
Public Functions
__init__(self, tarsqidoc, sentence, event)
get_value(self, attr)
is_event_vector(self)
class PairVector
Inherits from: Vector
Public Functions
__init__(self, tarsqidoc, prefix1, vector1, prefix2, vector2)
Initialize a pair vector from two object vectors by setting an
identifier and by adding the features of the object vectors.
__str__(self)
Private Functions
_get_filename(self)
_inherit_object_features(self)
Copy the features from the object vectors.
_set_identifier(self)
class TimexVector
Inherits from: Vector
Implements a vector with internal features of the timex tag.
Public Functions
__init__(self, tarsqidoc, sentence, timex)
get_value(self, attr)
is_timex_vector(self)
class Vector
Inherits from: object
Public Functions
__init__(self, tarsqidoc, sentence, source, source_tag, features)
__str__(self)
add_feature(self, feat, val)
is_event_vector(self)
is_timex_vector(self)
module functions
abbreviate(attr)
Abbreviate the feature name, but abbreviate only the part without the
prefix (which can be e-, t-, e1- or e2-).
collect_tarsqidoc_vectors(tarsqidoc)
Collect vectors for the TarsqiDocument.
create_tarsqidoc_vectors(tarsqidoc, ee_file, et_file)
Create vectors for the TarsqiDocument and write them to two files.
make_vector(tarsqidoc, s, tag)
Factory nethod to create a vector for an event tag or timex tag.
write_vectors(ee_file, ee_vectors, et_file, et_vectors)
Write the vectors to files.