Baby Language Lab Scripts
A collection of data processing tools.
 All Classes Namespaces Files Functions Variables Pages
parsers.state_machines.LinkUttersStateMachine Class Reference

This class handles the job of linking together Utterances (via their next/prev pointers) that are marked with I/C codes (transcriber code 3) by the transcribers. More...

Inheritance diagram for parsers.state_machines.LinkUttersStateMachine:

Public Member Functions

def __init__
 Constructor. More...
 
def drive
 Drives the state machine ahead on step. More...
 
def finish
 This method ensures that errors are generated for any utterances that are still waiting around for a link. More...
 

Public Attributes

 trs_parser
 
 link_dict
 
 cur_linkable_seg
 
 last_linkable_seg
 
 logger
 

Private Member Functions

def _get_seg_contents
 Constructs a string that is formatted as indented list of information about all utterances in a given segment. More...
 

Detailed Description

This class handles the job of linking together Utterances (via their next/prev pointers) that are marked with I/C codes (transcriber code 3) by the transcribers.

Utterances are 'linkable' if an I/C code can be used to tie them to another utterance. They are 'unlinkable' if they cannot be. Unlinkable Utterances usually consist of silence (speaker is SIL), or non-verbal noise (and have no transcription phrase). The ''is_linkable column of the 'speaker_codes' database table defines the particular speakers that make an utterance linkable/unlinkable. In addition to linking Utterances, this class also provides error detection for problems like 'I without C', 'C without I', 'ambiguous I/C codes', etc. These errors are appended to the TRSParser's ErrorCollector. Utterances are only linked across segments (not within segments). The transcriber manual dictates that when ambiguous I/C codes are used, they must be numbered (eg. I, I1, and I2, link to C, C1, and C2, respectively). These numbers are referred to as 'link numbers' (not to be confused with 'segment numbers', which refer to Segment objects' 'num' attributes). In order to simplify the linking process, the state machine considers the initial I or C codes to have the number 0 (eg. I links to C becomes I0 links to C0). Usage: after instantiating the class, call drive() with every Utterance. Then call finish().

Definition at line 166 of file state_machines.py.

Constructor & Destructor Documentation

def parsers.state_machines.LinkUttersStateMachine.__init__ (   self,
  trs_parser 
)

Constructor.

Parameters
self
trs_parser(TRSParser) This class must be driven from an instance of a TRSParser

Definition at line 170 of file state_machines.py.

Member Function Documentation

def parsers.state_machines.LinkUttersStateMachine._get_seg_contents (   self,
  seg 
)
private

Constructs a string that is formatted as indented list of information about all utterances in a given segment.

This is useful to tack on to error messages.

Parameters
self
seg(Segment) segment object for which to generate a list of utterance info
Returns
(string) an indented string containing speaker, start/end times, lena notes, transcription phrase, transcriber codes, etc. for each utterance in the segment.

Definition at line 190 of file state_machines.py.

def parsers.state_machines.LinkUttersStateMachine.drive (   self,
  next_obj 
)

Drives the state machine ahead on step.

Parameters
self
next_obj(Utterance) the next Utterance to consider in the linking process

Definition at line 212 of file state_machines.py.

def parsers.state_machines.LinkUttersStateMachine.finish (   self)

This method ensures that errors are generated for any utterances that are still waiting around for a link.

This routine must be called after drive() - otherwise, you'll (potentially) be missing some errors.

Parameters
self

Definition at line 303 of file state_machines.py.

Member Data Documentation

parsers.state_machines.LinkUttersStateMachine.cur_linkable_seg

Definition at line 179 of file state_machines.py.

parsers.state_machines.LinkUttersStateMachine.last_linkable_seg

Definition at line 181 of file state_machines.py.

parsers.state_machines.LinkUttersStateMachine.link_dict

Definition at line 174 of file state_machines.py.

parsers.state_machines.LinkUttersStateMachine.logger

Definition at line 184 of file state_machines.py.

parsers.state_machines.LinkUttersStateMachine.trs_parser

Definition at line 171 of file state_machines.py.


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