Baby Language Lab Scripts
A collection of data processing tools.
 All Classes Namespaces Files Functions Variables Pages
data_structs.output_calcs.OutputCalc Class Reference

An OutputCalc encapsulates all of the calculations for a particular output. More...

Inheritance diagram for data_structs.output_calcs.OutputCalc:

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...
 
- Public Member Functions inherited from data_structs.base_objects.BLLObject
def __str__
 Builds a nicely formatted string containing all attributes of this object (except those in omit_attr_names), for debugging purposes. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

def data_structs.output_calcs.OutputCalc.__init__ (   self)

Constructor.

Parameters
self

Definition at line 20 of file output_calcs.py.

Member Function Documentation

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.

Parameters
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.

Parameters
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.)

Parameters
self
Returns
(string) short type description string to display in the UI

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).

Parameters
self
Returns
(list) list of args to pass to the constructor when the object is recreated from the DB at a later date

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.

Parameters
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.

Parameters
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.


The documentation for this class was generated from the following file: