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

This class handles the task of generating Utterance objects from the data within a. More...

Inheritance diagram for parsers.state_machines.ParseUttersStateMachine:

Public Member Functions

def __init__
 Constructor. More...
 
def drive
 Pushes the state machine forward a single step. More...
 
def finish
 Completes any unfinished Utterances that may be waiting for additional information (eg. More...
 
def get_result
 Retreieves the list of Utterances that this state machine has constructed. More...
 

Public Attributes

 logger
 
 trs_parser
 
 seg
 
 remove_bad_trans_codes
 
 utter_list
 
 States
 
 cur_state
 

Detailed Description

This class handles the task of generating Utterance objects from the data within a.

<Turn></Turn>

element.

Tags of interest of here:

<Sync time="8.32" />

This is a single tag that indicates a boundary in the audio that LENA has found.

<Who nb="1" />

This is a single tag that appears directly after a sync tag, or directly after another who tag. LENA generates who tags when there are multiple speakers within the same turn. The nb attribute is the index of the speaker (starting at 1, not 0) in the (space-delimited) speaker list contained within the turn tag's 'speaker' attribute.

Raw data appears immediately after either of these tags. This data appears as one or more lines in the following form:

 <optional LENA code like VOC, SIL, etc.> <optional transcribed phrase> <optional LENA-generated codes separated by pipes - eg. |E|1|0|XM|> <optional transcriber codes separated by pipes - eg. |U|T|I|Q|>

Since this data appears after sync or who tags (as opposed to between tags), it's tricky to pull of the information we want. Hence this state machine.

Comment: If you need to interact with/modify this class, it would be helpful to read the transcriber manual first.

Usage: after instantiating the class, call drive() with each element up to (but not including) the last one. Then, call finish() with the last element.

Definition at line 31 of file state_machines.py.

Constructor & Destructor Documentation

def parsers.state_machines.ParseUttersStateMachine.__init__ (   self,
  trs_parser,
  seg,
  remove_bad_trans_codes 
)

Constructor.

Parameters
selftrs_parser (TRSParser) this state machine must be driven by an instance of the TRSParser class - this is a pointer to that instance
seg(Segment) this is a pointer to the Segment object for which the TRSParser is using this class to generate Utterances for.

Definition at line 36 of file state_machines.py.

Member Function Documentation

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

Pushes the state machine forward a single step.

Parameters
self
next_obj(Element) this is an Element object (defined in the Python ElementTree library) corresponding to the next node of the XML file that has been encountered.

Definition at line 51 of file state_machines.py.

def parsers.state_machines.ParseUttersStateMachine.finish (   self,
  final_obj 
)

Completes any unfinished Utterances that may be waiting for additional information (eg.

end times).

Parameters
self
final_obj(Element) a Python ElementTree library XML node object, representing the last tag encountered in the
<Turn></Turn>

Definition at line 137 of file state_machines.py.

def parsers.state_machines.ParseUttersStateMachine.get_result (   self)

Retreieves the list of Utterances that this state machine has constructed.

This method should only be called after finish() has been called (Otherwise there may be incomplete Utterances in the returned list)

Parameters
self
Returns
(list) list of Utterance objects

Definition at line 154 of file state_machines.py.

Member Data Documentation

parsers.state_machines.ParseUttersStateMachine.cur_state

Definition at line 46 of file state_machines.py.

parsers.state_machines.ParseUttersStateMachine.logger

Definition at line 38 of file state_machines.py.

parsers.state_machines.ParseUttersStateMachine.remove_bad_trans_codes

Definition at line 42 of file state_machines.py.

parsers.state_machines.ParseUttersStateMachine.seg

Definition at line 41 of file state_machines.py.

parsers.state_machines.ParseUttersStateMachine.States

Definition at line 45 of file state_machines.py.

parsers.state_machines.ParseUttersStateMachine.trs_parser

Definition at line 40 of file state_machines.py.

parsers.state_machines.ParseUttersStateMachine.utter_list

Definition at line 44 of file state_machines.py.


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