![]() |
Baby Language Lab Scripts
A collection of data processing tools.
|
An OutputCalc encapsulates all of the calculations for a particular output. More...
Public Member Functions | |
def | __init__ |
Constructor. More... | |
def | get_db_args |
Retreives an ordered list of args needed to instantiate this object these will be inserted into the DB. More... | |
def | get_calc_type_str |
Retreives a short description string that indicates what type of calculation this object is performing (eg. More... | |
def | add_seg |
Adds an unlinked segment to be considered in the calculations that this object is performing. More... | |
def | add_chain |
Adds a linked segment (i.e. More... | |
def | write_csv_rows |
Writes a short description of the calculation, along with the calculation results, to a csv file. More... | |
def | reset |
This method clears any cached data from previous run (anything added by add_seg() or add_chain()), in preparation for new run. More... | |
![]() | |
def | __str__ |
Builds a nicely formatted string containing all attributes of this object (except those in omit_attr_names), for debugging purposes. More... | |
An OutputCalc encapsulates all of the calculations for a particular output.
There is a one-to-one relationship between Outputs and OutputCalcs. This is an abstract base class - all subclasses should implement the methods defined here. Idea: the add_seg() and add_chain() methods take in segs to be included in the calculation. Finally, write_segs() is called, which writes the results to a spreadsheet file. Since output calcs can deal with either segments or chains, it is convenient to refer to them collectively as 'items' in this documentation.
Definition at line 17 of file output_calcs.py.
def data_structs.output_calcs.OutputCalc.__init__ | ( | self | ) |
def data_structs.output_calcs.OutputCalc.add_chain | ( | self, | |
head | |||
) |
Adds a linked segment (i.e.
an Utterance) to be considered in the calculations that this object is performing.
self | |
head | (Utterance) the head of a chain of potentially linked Utterances. The whole chain will be considered in this object's calculations. |
Definition at line 44 of file output_calcs.py.
def data_structs.output_calcs.OutputCalc.add_seg | ( | self, | |
seg | |||
) |
Adds an unlinked segment to be considered in the calculations that this object is performing.
self | |
seg | (Segment) A segment to consider in this object's calculations. |
Definition at line 38 of file output_calcs.py.
def data_structs.output_calcs.OutputCalc.get_calc_type_str | ( | self | ) |
Retreives a short description string that indicates what type of calculation this object is performing (eg.
'Count', 'Time Period', etc.)
self |
Definition at line 32 of file output_calcs.py.
def data_structs.output_calcs.OutputCalc.get_db_args | ( | self | ) |
Retreives an ordered list of args needed to instantiate this object these will be inserted into the DB.
(this list will be passed directly to the constructor when the object is reinstantiated from the DB).
self |
Definition at line 26 of file output_calcs.py.
def data_structs.output_calcs.OutputCalc.reset | ( | self | ) |
This method clears any cached data from previous run (anything added by add_seg() or add_chain()), in preparation for new run.
self |
Definition at line 55 of file output_calcs.py.
def data_structs.output_calcs.OutputCalc.write_csv_rows | ( | self, | |
csv_writer | |||
) |
Writes a short description of the calculation, along with the calculation results, to a csv file.
self | |
csv_writer | (CSVWriter) this is a Python csv library writer objects, configured to write to the appropriate csv file. |
Definition at line 50 of file output_calcs.py.