![]() |
Baby Language Lab Scripts
A collection of data processing tools.
|
An Output represents particular statistic that the user is trying to calculate from a TRS file. More...
Public Member Functions | |
def | __init__ |
Constructor. More... | |
def | reset |
Clears any cached utterances in preparation for a new run. More... | |
def | add_item |
Accepts a segment/chain, filters it, and (if it passes through the filters) factors it into this output's calculations. More... | |
def | get_filtered_items |
Grabs a list of all items that have been added to this Output that have passed through the filters. More... | |
def | db_insert |
See superclass description. More... | |
def | db_delete |
def | write_csv_rows |
Writes a description of this output, and the calculated information from this output, to a CSV file. More... | |
![]() | |
def | __init__ |
Constructor. More... | |
def | db_insert |
Performs operations needed to insert this object into the database. More... | |
def | db_delete |
Performs operations needed to delete this object from the database. More... | |
![]() | |
def | __str__ |
Builds a nicely formatted string containing all attributes of this object (except those in omit_attr_names), for debugging purposes. More... | |
Static Public Member Functions | |
def | db_select |
See superclass description. More... | |
def | db_select_by_ref |
Selects Outputs via a relationship table (a table linking output ids to some other type of id). More... | |
![]() | |
def | db_select |
Selects objects of this type from the database. More... | |
Public Attributes | |
name | |
desc | |
filters | |
output_calc | |
chained | |
db_id | |
segs | |
chains | |
![]() | |
db_id | |
Private Member Functions | |
def | _add_seg |
Adds an unlinked segment to this Output, if it passes through the filters. More... | |
def | _add_chain |
Adds chain (an Utterance) to this Output, if it passes through the filters. More... | |
An Output represents particular statistic that the user is trying to calculate from a TRS file.
It is used in the Statistics Application. Each Output corresponds to a single Configuration object. Configurations can have multiple Outputs. The exported spreadsheet constains a single section for each Output in the selected Configuration. Calling code should instantiate this object, then use it's add_item() method to pass in segments/chains that it want's included in this output's calculations.
def data_structs.output.Output.__init__ | ( | self, | |
name, | |||
desc, | |||
filters, | |||
output_calc, | |||
chained, | |||
db_id = None |
|||
) |
Constructor.
self | |
name | (string) the user-specified name for this output |
desc | (string) the user-specified description for this output |
filters | (list) list of SegFilter objects to apply to data that is inserted into this Output |
output_calc | (OutputCalc) an object used to perform any arithmetic/processing needed to generate this output's section in the spreadsheet file |
chained | (boolean) True if we're using linked segments, False if we're using unlinked segments |
db_id | (int=None) database primary key value for this object - code should not set, it's set via db_insert() and db_select(). A value of None indicates that this Output is not in the database. |
|
private |
|
private |
Adds an unlinked segment to this Output, if it passes through the filters.
self | |
seg | (Segment) the Segment object to add |
filter_utters | (boolean=False) see description for add_item() |
def data_structs.output.Output.add_item | ( | self, | |
item, | |||
filter_utters = False |
|||
) |
Accepts a segment/chain, filters it, and (if it passes through the filters) factors it into this output's calculations.
self | |
item | (Segment / Utterance) the data object to add to this output. If chained is set to True, this should be an Utterance object (potentially linked to other Utterance objects via its 'next'/'prev' pointers). If chained is False, this should be a Segment object. |
filter_utters | (boolean=False) If True, and chained == False, then any utterances that don't pass the filter will be stripped out of the segments passed in (but the segment itself will still be included if it has other utterances. If False, and chained == False, then it the segment that's passed in has any utterance that fails to pass the filter, the whole segment will be excluded. If chained == True, the setting of this parameter has no effect (in all cases, if one node in the chain fails to pass the filter, the whole chain is excluded - conceptually, chains are treated as a single, long Utterance). |
def data_structs.output.Output.db_insert | ( | self, | |
db | |||
) |
|
static |
|
static |
Selects Outputs via a relationship table (a table linking output ids to some other type of id).
db | (BLLDatabase) a database handle object to use for the select operation |
ref_table | (string) the name of the relationship table to use |
id_col | (string) name of the column (in ref_table) containing output |
ref_col | (string) name of the column (in ref table) containing the value you want to look up outputs by |
ref_val | (int) value to search for in ref_col. For each matching row, the id_col value is obtained (this is the output id), and used to do a lookup in the outputs table. |
def data_structs.output.Output.get_filtered_items | ( | self | ) |
def data_structs.output.Output.reset | ( | self | ) |
def data_structs.output.Output.write_csv_rows | ( | self, | |
csv_writer | |||
) |