annotations.TGA package¶
Submodules¶
annotations.TGA.sppastga module¶
- filename
sppas.src.annotations.TGA.sppastga.py
- author
Brigitte Bigi
- contact
- summary
SPPAS integration of TGA automatic annotation
- class annotations.TGA.sppastga.sppasTGA(log=None)[source]¶
Bases:
annotations.baseannot.sppasBaseAnnotation
Estimate TGA on a tier – from D. Gibbon.
Create time groups then map them into a dictionary where:
key is a label assigned to the time group;
value is the list of observed durations of segments in this TG.
- __init__(log=None)[source]¶
Create a new sppasTGA instance.
Log is used for a better communication of the annotation process and its results. If None, logs are redirected to the default logging system.
- Parameters
log – (sppasLog) Human-readable logs.
- convert(syllables)[source]¶
Estimate TGA on the given syllables.
- Parameters
syllables – (sppasTier)
- Returns
(sppasTranscription)
- fix_options(options)[source]¶
Fix all options.
Available options are:
with_radius
original
annotationpro
tg_prefix_label
- Parameters
options – (sppasOption)
- get_inputs(input_files)[source]¶
Return the the tier with aligned tokens.
- Parameters
input_files – (list)
- Raise
NoTierInputError
- Returns
(sppasTier)
- run(input_files, output=None)[source]¶
Run the automatic annotation process on an input.
- Parameters
input_files – (list of str) Syllabification
output – (str) the output file name
- Returns
(sppasTranscription)
- set_intercept_slope_annotationpro(value)[source]¶
Estimate intercepts and slopes with the method of annotationpro.
Default is True.
- Parameters
value – (boolean)
- set_intercept_slope_original(value)[source]¶
Estimate intercepts and slopes with the original method.
Default is False.
- Parameters
value – (boolean)
- set_tg_prefix_label(prefix)[source]¶
Fix the prefix to add to each TG.
- Parameters
prefix – (str) Default is ‘tg_’
- set_with_radius(with_radius)[source]¶
Set the with_radius option, used to estimate the duration.
- Parameters
with_radius – (int)
0 means to use Midpoint;
negative value means to use R-;
positive radius means to use R+.
- syllables_to_timegroups(syllables)[source]¶
Create the time group intervals.
- Parameters
syllables – (sppasTier)
- Returns
(sppasTier) Time groups
- syllables_to_timesegments(syllables)[source]¶
Create the time segments intervals.
Time segments are time groups with serialized syllables.
- Parameters
syllables –
- Returns
(sppasTier) Time segments
- static tga_to_tier(tga_result, timegroups, tier_name, tag_type='float')[source]¶
Create a tier from one of the TGA result.
- Parameters
tga_result – One of the results of TGA
timegroups – (sppasTier) Time groups
tier_name – (str) Name of the output tier
tag_type – (str) Type of the sppasTag to be included
- Returns
(sppasTier)
- static tga_to_tier_reglin(tga_result, timegroups, intercept=True)[source]¶
Create tiers of intercept,slope from one of the TGA result.
- Parameters
tga_result – One of the results of TGA
timegroups – (sppasTier) Time groups
intercept – (boolean) Export the intercept.
If False, export Slope.
- Returns
(sppasTier)
annotations.TGA.timegroupanalysis module¶
- filename
sppas.src.annotations.TGA.timegroupanalysis.py
- author
Brigitte Bigi
- contact
- summary
The time group analyzer partly re-implemented
- class annotations.TGA.timegroupanalysis.TimeGroupAnalysis(dict_items)[source]¶
Bases:
sppas.src.calculus.stats.descriptivesstats.sppasDescriptiveStatistics
Time Group Analyzer estimator class.
TGA: Time Group Analyzer is an online tool for speech annotation mining written by Dafydd Gibbon (Universität Bielefeld).
See: <http://wwwhomes.uni-bielefeld.de/gibbon/TGA/>
This class estimates TGA on a set of data values, stored in a dictionary:
key is the name of the time group;
value is the list of durations of each segments in the time group.
>>> d = {'tg1':[1.0, 1.2, 3.2, 4.1] , 'tg2':[2.9, 3.3, 3.6, 5.8]} >>> tga = TimeGroupAnalysis(d) >>> total = tga.total() >>> intercept, slope = tga.intercept_slope() >>> print(slope['tg_1']) >>> print(slope['tg_2'])
- __init__(dict_items)[source]¶
TGA - The Time Group Analyzer.
- Parameters
dict_items – (dict) a dict of a list of durations.
- intercept_slope()[source]¶
Estimate the intercept like AnnotationPro of data values.
- Create the list of points (x,y) of each TG where:
x is the timestamps
y is the duration
- Returns
(dict) a dict of (key, (intercept, slope)) of float values
- intercept_slope_original()[source]¶
Estimate the intercept like the original TGA of data values.
- Create the list of points (x,y) of each TG where:
x is the position
y is the duration
- Returns
(dict) a dict of (key, (intercept,slope)) of float values
Module contents¶
- filename
sppas.src.annotations.TGA.__init__.py
- author
Brigitte Bigi
- contact
- summary
Time-Group Analyzer automatic annotation.
TGA: Time Group Analyzer is an online tool for speech annotation mining written by Dafydd Gibbon, emeritus professor of English and General Linguistics at Bielefeld University..
TGA software calculates, inter alia, mean, median, rPVI, nPVI, slope and intercept functions within inter-pausal groups.
- For details, read the following reference:
- Dafydd Gibbon (2013).TGA: a web tool for Time Group Analysis.Tools ans Resources for the Analysis of Speech Prosody,Aix-en-Provence, France, pp. 66-69.
See also: <http://wwwhomes.uni-bielefeld.de/gibbon/TGA/>
- class annotations.TGA.TimeGroupAnalysis(dict_items)[source]¶
Bases:
sppas.src.calculus.stats.descriptivesstats.sppasDescriptiveStatistics
Time Group Analyzer estimator class.
TGA: Time Group Analyzer is an online tool for speech annotation mining written by Dafydd Gibbon (Universität Bielefeld).
See: <http://wwwhomes.uni-bielefeld.de/gibbon/TGA/>
This class estimates TGA on a set of data values, stored in a dictionary:
key is the name of the time group;
value is the list of durations of each segments in the time group.
>>> d = {'tg1':[1.0, 1.2, 3.2, 4.1] , 'tg2':[2.9, 3.3, 3.6, 5.8]} >>> tga = TimeGroupAnalysis(d) >>> total = tga.total() >>> intercept, slope = tga.intercept_slope() >>> print(slope['tg_1']) >>> print(slope['tg_2'])
- __init__(dict_items)[source]¶
TGA - The Time Group Analyzer.
- Parameters
dict_items – (dict) a dict of a list of durations.
- intercept_slope()[source]¶
Estimate the intercept like AnnotationPro of data values.
- Create the list of points (x,y) of each TG where:
x is the timestamps
y is the duration
- Returns
(dict) a dict of (key, (intercept, slope)) of float values
- intercept_slope_original()[source]¶
Estimate the intercept like the original TGA of data values.
- Create the list of points (x,y) of each TG where:
x is the position
y is the duration
- Returns
(dict) a dict of (key, (intercept,slope)) of float values
- class annotations.TGA.sppasTGA(log=None)[source]¶
Bases:
annotations.baseannot.sppasBaseAnnotation
Estimate TGA on a tier – from D. Gibbon.
Create time groups then map them into a dictionary where:
key is a label assigned to the time group;
value is the list of observed durations of segments in this TG.
- __init__(log=None)[source]¶
Create a new sppasTGA instance.
Log is used for a better communication of the annotation process and its results. If None, logs are redirected to the default logging system.
- Parameters
log – (sppasLog) Human-readable logs.
- convert(syllables)[source]¶
Estimate TGA on the given syllables.
- Parameters
syllables – (sppasTier)
- Returns
(sppasTranscription)
- fix_options(options)[source]¶
Fix all options.
Available options are:
with_radius
original
annotationpro
tg_prefix_label
- Parameters
options – (sppasOption)
- get_inputs(input_files)[source]¶
Return the the tier with aligned tokens.
- Parameters
input_files – (list)
- Raise
NoTierInputError
- Returns
(sppasTier)
- run(input_files, output=None)[source]¶
Run the automatic annotation process on an input.
- Parameters
input_files – (list of str) Syllabification
output – (str) the output file name
- Returns
(sppasTranscription)
- set_intercept_slope_annotationpro(value)[source]¶
Estimate intercepts and slopes with the method of annotationpro.
Default is True.
- Parameters
value – (boolean)
- set_intercept_slope_original(value)[source]¶
Estimate intercepts and slopes with the original method.
Default is False.
- Parameters
value – (boolean)
- set_tg_prefix_label(prefix)[source]¶
Fix the prefix to add to each TG.
- Parameters
prefix – (str) Default is ‘tg_’
- set_with_radius(with_radius)[source]¶
Set the with_radius option, used to estimate the duration.
- Parameters
with_radius – (int)
0 means to use Midpoint;
negative value means to use R-;
positive radius means to use R+.
- syllables_to_timegroups(syllables)[source]¶
Create the time group intervals.
- Parameters
syllables – (sppasTier)
- Returns
(sppasTier) Time groups
- syllables_to_timesegments(syllables)[source]¶
Create the time segments intervals.
Time segments are time groups with serialized syllables.
- Parameters
syllables –
- Returns
(sppasTier) Time segments
- static tga_to_tier(tga_result, timegroups, tier_name, tag_type='float')[source]¶
Create a tier from one of the TGA result.
- Parameters
tga_result – One of the results of TGA
timegroups – (sppasTier) Time groups
tier_name – (str) Name of the output tier
tag_type – (str) Type of the sppasTag to be included
- Returns
(sppasTier)
- static tga_to_tier_reglin(tga_result, timegroups, intercept=True)[source]¶
Create tiers of intercept,slope from one of the TGA result.
- Parameters
tga_result – One of the results of TGA
timegroups – (sppasTier) Time groups
intercept – (boolean) Export the intercept.
If False, export Slope.
- Returns
(sppasTier)