|
Baby Language Lab Scripts
A collection of data processing tools.
|
This OutputCalc searches for a regex match in a segment/chain phrase and counts the number of matches, then divides the count by the length of the segment in seconds. More...

Public Member Functions | |
| def | __init__ |
| Constructor. More... | |
| def | reset |
| See superclass description. More... | |
| def | get_db_args |
| See superclass description. More... | |
| def | get_calc_type_str |
| See superclass description. More... | |
| def | add_seg |
| See superclass description. More... | |
| def | add_chain |
| See superclass description. More... | |
| def | write_csv_rows |
| See superclass description. More... | |
Public Member Functions inherited from data_structs.output_calcs.OutputCalc | |
| 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... | |
Public Attributes | |
| logger | |
| search_term | |
| rate_type | |
| chain_dict | |
| utter_dict | |
Static Public Attributes | |
| RATE_TYPES = None | |
Private Member Functions | |
| def | _init_data_structs |
| Initializes internal data structures used to record items added to this OutputCalc. More... | |
| def | _write_per_seg |
| Writes the results for a 'per item' rate calculation to a spreadsheet file. More... | |
| def | _write_avg_across_segs |
| Writes the results for a 'average across items' rate calculation to a spreadsheet file. More... | |
This OutputCalc searches for a regex match in a segment/chain phrase and counts the number of matches, then divides the count by the length of the segment in seconds.
The output is a measure of count/sec. This can be computed for each item individually ('per item'), or as an average across items.
Definition at line 225 of file output_calcs.py.
| def data_structs.output_calcs.RateOutputCalc.__init__ | ( | self, | |
| search_term, | |||
| rate_type | |||
| ) |
Constructor.
| self | |
| search | term (string) a Python regular expression to search for in the the item phrases. |
| rate_type | (int) one of the options from the enum RateOutputCalc.RATE_TYPES - indicating how the rate is to be calculated (per item, or average across items) |
Definition at line 233 of file output_calcs.py.
|
private |
Initializes internal data structures used to record items added to this OutputCalc.
| self |
Definition at line 241 of file output_calcs.py.
|
private |
Writes the results for a 'average across items' rate calculation to a spreadsheet file.
This consists of a single row containing the average. The average is calculated as (sum of number of matches across all items) / (sum of lengths of all items, in seconds)
Definition at line 346 of file output_calcs.py.
|
private |
Writes the results for a 'per item' rate calculation to a spreadsheet file.
This consists of a single row for each item, with it's corresponding rate.
| self | |
| chained | (boolean) True if we are considering linked segments, False if unlinked. |
| csv_writer | (CSVWriter) Python csv library writer object, set to write to the appropriate csv file. |
Definition at line 306 of file output_calcs.py.
| def data_structs.output_calcs.RateOutputCalc.add_chain | ( | self, | |
| head | |||
| ) |
See superclass description.
Definition at line 278 of file output_calcs.py.
| def data_structs.output_calcs.RateOutputCalc.add_seg | ( | self, | |
| seg | |||
| ) |
See superclass description.
Definition at line 258 of file output_calcs.py.
| def data_structs.output_calcs.RateOutputCalc.get_calc_type_str | ( | self | ) |
See superclass description.
Definition at line 254 of file output_calcs.py.
| def data_structs.output_calcs.RateOutputCalc.get_db_args | ( | self | ) |
See superclass description.
Definition at line 250 of file output_calcs.py.
| def data_structs.output_calcs.RateOutputCalc.reset | ( | self | ) |
See superclass description.
Definition at line 246 of file output_calcs.py.
| def data_structs.output_calcs.RateOutputCalc.write_csv_rows | ( | self, | |
| chained, | |||
| csv_writer | |||
| ) |
See superclass description.
Definition at line 361 of file output_calcs.py.
| data_structs.output_calcs.RateOutputCalc.chain_dict |
Definition at line 242 of file output_calcs.py.
| data_structs.output_calcs.RateOutputCalc.logger |
Definition at line 234 of file output_calcs.py.
| data_structs.output_calcs.RateOutputCalc.rate_type |
Definition at line 236 of file output_calcs.py.
|
static |
Definition at line 227 of file output_calcs.py.
| data_structs.output_calcs.RateOutputCalc.search_term |
Definition at line 235 of file output_calcs.py.
| data_structs.output_calcs.RateOutputCalc.utter_dict |
Definition at line 243 of file output_calcs.py.