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

Merges split files back into a single TRS file. More...

Inheritance diagram for parsers.trs_splitter.TRSMerger:

Public Member Functions

def __init__
 Constructor. More...
 
def merge
 Performs the acutal merger, writing the results to a destination file with the name "<old name>-merged.trs". More...
 

Public Attributes

 src_dir
 
 split_files
 
 filename_base
 

Private Member Functions

def _get_void_speaker_id
 Finds the id number of the VOID speaker that was inserted when the original TRS file was split (see TRSSplitter class) More...
 
def _remove_void_speaker
 Removes the void speaker from the given XML tree. More...
 
def _cmp_filenames
 This comparison function is used to sort the split files into ascending order before they are merged. More...
 

Detailed Description

Merges split files back into a single TRS file.

Definition at line 155 of file trs_splitter.py.

Constructor & Destructor Documentation

def parsers.trs_splitter.TRSMerger.__init__ (   self,
  src_dir 
)

Constructor.

Parameters
self
src_dir(string) full path to the directory containing the split files

Definition at line 159 of file trs_splitter.py.

Member Function Documentation

def parsers.trs_splitter.TRSMerger._cmp_filenames (   self,
  x,
  y 
)
private

This comparison function is used to sort the split files into ascending order before they are merged.

This is done using the index appended to the end of the filename by the splitter app.

Parameters
self
x(string) filename number one
y(string) filename number two
Returns
(int) 0 if names are identical, -1 if filename x should come before filename y, 1 if filename x should come after filename y

Definition at line 247 of file trs_splitter.py.

def parsers.trs_splitter.TRSMerger._get_void_speaker_id (   self,
  tree 
)
private

Finds the id number of the VOID speaker that was inserted when the original TRS file was split (see TRSSplitter class)

Parameters
self
tree(etree ElementTree) The XML tree object to search.
Returns
(int) the id of the void speaker, as determined from the "Speaker" tag (which lists all speakers in the file)

Definition at line 172 of file trs_splitter.py.

def parsers.trs_splitter.TRSMerger._remove_void_speaker (   self,
  tree 
)
private

Removes the void speaker from the given XML tree.

Parameters
self
tree(etree ElementTree) the XML tree to search

Definition at line 188 of file trs_splitter.py.

def parsers.trs_splitter.TRSMerger.merge (   self,
  progress_update_fcn = None 
)

Performs the acutal merger, writing the results to a destination file with the name "<old name>-merged.trs".

Parameters
self
progress_update_fcn(function=None) function that updates the progress bar, accepting a single parameter, a real number in [0.0, 1.0]

Definition at line 204 of file trs_splitter.py.

Member Data Documentation

parsers.trs_splitter.TRSMerger.filename_base

Definition at line 166 of file trs_splitter.py.

parsers.trs_splitter.TRSMerger.split_files

Definition at line 162 of file trs_splitter.py.

parsers.trs_splitter.TRSMerger.src_dir

Definition at line 160 of file trs_splitter.py.


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