![]() |
Baby Language Lab Scripts
A collection of data processing tools.
|
This class holds a chunk of information from the TRS file. More...
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... | |
![]() | |
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... | |
![]() | |
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... | |
![]() | |
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 | |
![]() | |
db_id | |
Private Member Functions | |
def | _iterate_speakers_until |
Iterates through this segment's list of speakers until a specified condition is reached. More... | |
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.
def data_structs.segment.Segment.__init__ | ( | self, | |
num, | |||
start, | |||
end, | |||
speakers = [] , |
|||
utters = [] , |
|||
db_id = None , |
|||
user_adj_start = None , |
|||
user_adj_end = None |
|||
) |
Constructor.
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.
|
private |
Iterates through this segment's list of speakers until a specified condition is reached.
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.) |
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.
|
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)
self |
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)
self |
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)
self |
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)
self |
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)
self |
Definition at line 49 of file segment.py.
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.