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

This class holds a chunk of information from the TRS file. More...

Inheritance diagram for data_structs.segment.Segment:

Public Member Functions

def __init__
 Constructor. More...
 
def has_silence
 Checks if this segment contains silence (i.e. More...
 
def has_distant
 Checks if this segment contains a speaker that is considered 'far/distant' (eg. More...
 
def has_overlapping_speech
 Checks if this segment contains a speaker that is considered 'overlapping speech' (eg. More...
 
def has_media
 Checks if this segment contains a speaker that is considered to be media. More...
 
def has_non_verbal_noise
 Checks if this segment contains a speaker that represents nonverbal noise (i.e. More...
 
def db_insert
 See superclass description. More...
 
def db_delete
 See superclass description. More...
 
- Public Member Functions inherited from data_structs.base_objects.DBObject
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...
 
- Public Member Functions inherited from data_structs.base_objects.BLLObject
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...
 
- Static Public Member Functions inherited from data_structs.base_objects.DBObject
def db_select
 Selects objects of this type from the database. More...
 

Public Attributes

 num
 
 speakers
 
 utters
 
 start
 
 end
 
 db_id
 
 user_adj_start
 
 user_adj_end
 
- Public Attributes inherited from data_structs.base_objects.DBObject
 db_id
 

Private Member Functions

def _iterate_speakers_until
 Iterates through this segment's list of speakers until a specified condition is reached. More...
 

Detailed Description

This class holds a chunk of information from the TRS file.

This corresponds to the information between a <Turn></Turn> pair of tags in a TRS file. Each <sync> or <who> group within the turn tags is an Utterance (caveat: if one <sync> or <who> tag has multiple lines, each line is a separate Utterance). Each Segment has a list of Utterances it contains. Utterances correspond to "bullet points" in transcriber.

Definition at line 12 of file segment.py.

Constructor & Destructor Documentation

def data_structs.segment.Segment.__init__ (   self,
  num,
  start,
  end,
  speakers = [],
  utters = [],
  db_id = None,
  user_adj_start = None,
  user_adj_end = None 
)

Constructor.

Parameters
self
num(int) a unique number that can be used to identify this segment (assigned by the TRS Parser)
start(float) start time (as recorded in the <Turn> tag)
end(float) end time (as recorded in the <Turn> tag)
speakers(list=[]) list of Speaker objects.
utters(list=[]) list of Utterance objects that this Segment contains
db_id(int=None) database table primary key (segments table). Is None if this Segment is not in the DB.

Definition at line 21 of file segment.py.

Member Function Documentation

def data_structs.segment.Segment._iterate_speakers_until (   self,
  cond_fcn 
)
private

Iterates through this segment's list of speakers until a specified condition is reached.

Parameters
self
cond_fcn(function) this function should accept a Speaker object, and return True (a value that Python considers True) when the iteration should stop. Otherwise it should return False (or None, 0, etc.)
Returns
(anything) returns whatever the cond_fcn returns, provided it evaluates to something Python considers True

Definition at line 37 of file segment.py.

def data_structs.segment.Segment.db_delete (   self,
  db 
)

See superclass description.

Definition at line 100 of file segment.py.

def data_structs.segment.Segment.db_insert (   self,
  db 
)

See superclass description.

Definition at line 82 of file segment.py.

def data_structs.segment.Segment.db_select (   db,
  ids = [] 
)
static

See superclass description.

Note: this method does not populate the 'num', or 'utters' attributes of segments. In addition, the segment's Speakers do not have their speaker_id attribute populated. The segments DB table does not bother to store this info, as currently, Utterance objects are only ever used after parsing a TRS file. This is probably not a very good reason - but if utterances or speaker objects ever need to be stored in the future, it's not difficult to add extra tables and link them to segments via foreign keys.

Definition at line 112 of file segment.py.

def data_structs.segment.Segment.has_distant (   self)

Checks if this segment contains a speaker that is considered 'far/distant' (eg.

FAF, MAF)

Parameters
self
Returns
(boolean) True if one or more speakers is considered 'far , False otherwise.

Definition at line 56 of file segment.py.

def data_structs.segment.Segment.has_media (   self)

Checks if this segment contains a speaker that is considered to be media.

(i.e. TVF, TVN)

Parameters
self
Returns
(boolean) True if one or more speakers are media, False otherwise

Definition at line 70 of file segment.py.

def data_structs.segment.Segment.has_non_verbal_noise (   self)

Checks if this segment contains a speaker that represents nonverbal noise (i.e.

NON, NOF)

Parameters
self
Returns
(boolean) True if one or more speakers are nonverbal noise, False otherwise

Definition at line 77 of file segment.py.

def data_structs.segment.Segment.has_overlapping_speech (   self)

Checks if this segment contains a speaker that is considered 'overlapping speech' (eg.

OLN, OLF)

Parameters
self
Returns
(boolean) True if one or more speakers is considered to be overlapping speech.

Definition at line 63 of file segment.py.

def data_structs.segment.Segment.has_silence (   self)

Checks if this segment contains silence (i.e.

if it contains the 'SIL' LENA speaker code)

Parameters
self
Returns
(boolean) True if one or more speakers is silence, False otherwise

Definition at line 49 of file segment.py.

Member Data Documentation

data_structs.segment.Segment.db_id

Definition at line 29 of file segment.py.

data_structs.segment.Segment.end

Definition at line 28 of file segment.py.

data_structs.segment.Segment.num

Definition at line 24 of file segment.py.

data_structs.segment.Segment.speakers

Definition at line 25 of file segment.py.

data_structs.segment.Segment.start

Definition at line 27 of file segment.py.

data_structs.segment.Segment.user_adj_end

Definition at line 31 of file segment.py.

data_structs.segment.Segment.user_adj_start

Definition at line 30 of file segment.py.

data_structs.segment.Segment.utters

Definition at line 26 of file segment.py.


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