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

This class provides information about/validation for a particular code. More...

Inheritance diagram for data_structs.codes.Code:

Public Member Functions

def __init__
 Constructor. More...
 
def get_option
 Retreives a CodeInfo object for a specified option. More...
 
def get_all_options_codes
 Retreives a list of all possible options for this code. More...
 
def get_tests
 This function returns a list of functions that are called, one by one, upon validation. More...
 
def is_valid
 Validates an option string for this Code object. More...
 

Public Attributes

 options_dict
 

Detailed Description

This class provides information about/validation for a particular code.

This could be a transcriber code, a LENA speaker code, a LENA notes code, or other potential types of codes. A code can have any number of options. Each option is a specific string value that the code can take on (eg. a LENA speaker code has options like 'MAN', 'FAN', etc.). This class also provides the ability fo valide code options that have been read from a TRS file.

Definition at line 12 of file codes.py.

Constructor & Destructor Documentation

def data_structs.codes.Code.__init__ (   self,
  options_dict 
)

Constructor.

Parameters
self
options_dict(dictionary) this is a dictionary with one key for each possible option. The value for each key must be a CodeInfo object for that particular option.

Definition at line 16 of file codes.py.

Member Function Documentation

def data_structs.codes.Code.get_all_options_codes (   self)

Retreives a list of all possible options for this code.

Parameters
self
Returns
(list) list of strings, one for each possible option

Definition at line 33 of file codes.py.

def data_structs.codes.Code.get_option (   self,
  code_str 
)

Retreives a CodeInfo object for a specified option.

Parameters
self
code_str(string) a string representing the option to lookup (eg. 'MAN' or 'FAN' for a LENA speaker code, 'M' or 'F' for transcriber code 1, etc.)
Returns
(CodeInfo) a CodeInfo object that can be used to retreive further details about the individual option

Definition at line 23 of file codes.py.

def data_structs.codes.Code.get_tests (   self)

This function returns a list of functions that are called, one by one, upon validation.

Each function should accept a single argument, a string containing the option text. They should return an array containing any error messages to present to the UI (or empty list if none).

Parameters
self
Returns
(list) list of functions

Definition at line 40 of file codes.py.

def data_structs.codes.Code.is_valid (   self,
  cd_str 
)

Validates an option string for this Code object.

To do so, it retreives a list of test functions from get_tests() and executes them one by one. The resulting lists are concatenated and the final list is returned.

Parameters
self
cd_str(string) string for the code option being validated.
Returns
(list) list of error messages, or empty list if no errors were encountered.

Definition at line 53 of file codes.py.

Member Data Documentation

data_structs.codes.Code.options_dict

Definition at line 17 of file codes.py.


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