annotations.IVA package

Submodules

annotations.IVA.intervalvaluesanalysis module

filename

sppas.src.annotations.IVA.intervalvaluesanzlysis.py

author

Brigitte Bigi

contact

develop@sppas.org

summary

Eval descriptive stats of values of a tier into intervals

class annotations.IVA.intervalvaluesanalysis.IntervalValuesAnalysis(dict_items)[source]

Bases: sppas.src.calculus.stats.descriptivesstats.sppasDescriptiveStatistics

Interval Values Analysis estimator class.

This class estimates IVA on a set of data values, stored in a dictionary:

  • key is the name of the segment;

  • value is the list of values observed in each segment.

>>> d = {'sgmt_1':[1.0, 1.2, 3.2, 4.1] , 'sgmt_2':[2.9, 3.3, 3.6, 5.8]}
>>> iva = IntervalValuesAnalysis(d)
>>> mean = iva.mean()
>>> intercept, slope = iva.intercept_slope()
>>> print(slope['sgmt_1'])
>>> print(slope['sgmt_2'])
__init__(dict_items)[source]

Create a new instance of IVA.

Parameters

dict_items – (dict) a dict of a list of float/int values.

intercept_slope()[source]

Estimate the intercept of data values, like for TGA.

Create the list of points (x,y) of each segment where:
  • x is the item index;

  • y is the value.

Returns

(dict) a dict of (key, (intercept, slope)) of float values

annotations.IVA.sppasiva module

filename

sppas.src.annotations.IVA.sppasiva.py

author

Brigitte Bigi

contact

develop@sppas.org

summary

SPPAS integration of the IVA automatic annotation.

class annotations.IVA.sppasiva.sppasIVA(log=None)[source]

Bases: annotations.baseannot.sppasBaseAnnotation

Estimate IVA on a tier.

Get or create segments then map them into a dictionary where:

  • key is a label assigned to the segment;

  • value is the list of observed values in the segment.

__init__(log=None)[source]

Create a new sppasIVA instance.

Parameters

log – (sppasLog) Human-readable logs.

convert(input_tier_values, input_tier_segments)[source]

Estimate IVA on the given input tier with values.

Parameters
  • input_tier_values – (sppasTier) Tier with numerical values.

  • input_tier_segments – (sppasTier) Tier with intervals.

Returns

(sppasTranscription)

fix_options(options)[source]

Fix all options.

Parameters

options – (sppasOption)

static get_input_extensions()[source]

Extensions that the annotation expects for its input filename.

An annotated file with measure values (pitch, intensity…), and An annotated file with a sppasTier of type ‘interval’.

get_input_patterns()[source]

Pattern this annotation expects for its input filename.

get_input_tiers(input_files)[source]

Return tiers with values and segments.

Parameters

input_files – (list)

get_output_pattern()[source]

Pattern this annotation uses in an output filename.

static iva_to_tier(iva_result, sgmts_tier, tier_name, tag_type='float')[source]

Create a tier from one of the IVA result (mean, sd, …).

Parameters
  • iva_result – One of the results of TGA

  • sgmts_tier – (sppasTier) Tier with the segments

  • tier_name – (str) Name of the output tier

  • tag_type – (str) Type of the sppasTag to be included

Returns

(sppasTier)

static iva_to_tier_reglin(iva_result, sgmts_tier, intercept=True)[source]

Create tiers of intercept,slope from the IVA result.

Parameters
  • iva_result – intercept,slope result of IVA

  • sgmts_tier – (sppasTier) Tier with the segments

  • intercept – (boolean) Export the intercept.

If False, export Slope.

Returns

(sppasTier)

run(input_files, output=None)[source]

Run the automatic annotation process on an input.

Parameters
  • input_files – (list of str) Values and Segments in a single file or in different ones

  • output – (str) the output file name

Returns

(sppasTranscription)

set_eval(occ=None, total=None, mean=None, median=None, stdev=None, linreg=None)[source]

Set IVA evaluations to perform.

Parameters
  • total – (bool) Estimates total of values in segments.

  • mean – (bool) Estimates mean of values in segments.

  • median – (bool) Estimates median of values in segments.

  • stdev – (bool) Estimates standard deviation of values in segments.

  • linreg – (bool) Estimates linear regression of values in segments.

set_input_tiername_segments(tiername)[source]

Fix the name of the tier with segments.

Parameters

tiername – (str) Default is ‘TokensAlign’

set_input_tiername_values(tiername)[source]

Fix the name of the tier with values.

Parameters

tiername – (str) Default is ‘PitchTier’

set_segments_separators(entry)[source]

Fix the separators to create segments.

Parameters

entry – (str) Entries separated by whitespace.

set_sgmt_prefix_label(prefix)[source]

Fix the prefix to add to each segment.

Parameters

prefix – (str) Default is ‘sgmt_

tier_to_labelled_segments(segments, input_tier_values)[source]

Create the segment intervals within the values.

Parameters
  • segments – (sppasTier) segment intervals to get values

  • input_tier_values – (sppasTier) tags are float/int values

Returns

(dict, sppasTier) dict of segment/values, labelled segments

tier_to_segments(input_tier)[source]

Create segment intervals.

Parameters

input_tier – (sppasTier)

Returns

(sppasTier)

Module contents

filename

sppas.src.annotations.IVA.__init__.py

author

Brigitte Bigi

contact

develop@sppas.org

summary

Interval Values Analysis - IVA

class annotations.IVA.IntervalValuesAnalysis(dict_items)[source]

Bases: sppas.src.calculus.stats.descriptivesstats.sppasDescriptiveStatistics

Interval Values Analysis estimator class.

This class estimates IVA on a set of data values, stored in a dictionary:

  • key is the name of the segment;

  • value is the list of values observed in each segment.

>>> d = {'sgmt_1':[1.0, 1.2, 3.2, 4.1] , 'sgmt_2':[2.9, 3.3, 3.6, 5.8]}
>>> iva = IntervalValuesAnalysis(d)
>>> mean = iva.mean()
>>> intercept, slope = iva.intercept_slope()
>>> print(slope['sgmt_1'])
>>> print(slope['sgmt_2'])
__init__(dict_items)[source]

Create a new instance of IVA.

Parameters

dict_items – (dict) a dict of a list of float/int values.

intercept_slope()[source]

Estimate the intercept of data values, like for TGA.

Create the list of points (x,y) of each segment where:
  • x is the item index;

  • y is the value.

Returns

(dict) a dict of (key, (intercept, slope)) of float values

class annotations.IVA.sppasIVA(log=None)[source]

Bases: annotations.baseannot.sppasBaseAnnotation

Estimate IVA on a tier.

Get or create segments then map them into a dictionary where:

  • key is a label assigned to the segment;

  • value is the list of observed values in the segment.

__init__(log=None)[source]

Create a new sppasIVA instance.

Parameters

log – (sppasLog) Human-readable logs.

convert(input_tier_values, input_tier_segments)[source]

Estimate IVA on the given input tier with values.

Parameters
  • input_tier_values – (sppasTier) Tier with numerical values.

  • input_tier_segments – (sppasTier) Tier with intervals.

Returns

(sppasTranscription)

fix_options(options)[source]

Fix all options.

Parameters

options – (sppasOption)

static get_input_extensions()[source]

Extensions that the annotation expects for its input filename.

An annotated file with measure values (pitch, intensity…), and An annotated file with a sppasTier of type ‘interval’.

get_input_patterns()[source]

Pattern this annotation expects for its input filename.

get_input_tiers(input_files)[source]

Return tiers with values and segments.

Parameters

input_files – (list)

get_output_pattern()[source]

Pattern this annotation uses in an output filename.

static iva_to_tier(iva_result, sgmts_tier, tier_name, tag_type='float')[source]

Create a tier from one of the IVA result (mean, sd, …).

Parameters
  • iva_result – One of the results of TGA

  • sgmts_tier – (sppasTier) Tier with the segments

  • tier_name – (str) Name of the output tier

  • tag_type – (str) Type of the sppasTag to be included

Returns

(sppasTier)

static iva_to_tier_reglin(iva_result, sgmts_tier, intercept=True)[source]

Create tiers of intercept,slope from the IVA result.

Parameters
  • iva_result – intercept,slope result of IVA

  • sgmts_tier – (sppasTier) Tier with the segments

  • intercept – (boolean) Export the intercept.

If False, export Slope.

Returns

(sppasTier)

run(input_files, output=None)[source]

Run the automatic annotation process on an input.

Parameters
  • input_files – (list of str) Values and Segments in a single file or in different ones

  • output – (str) the output file name

Returns

(sppasTranscription)

set_eval(occ=None, total=None, mean=None, median=None, stdev=None, linreg=None)[source]

Set IVA evaluations to perform.

Parameters
  • total – (bool) Estimates total of values in segments.

  • mean – (bool) Estimates mean of values in segments.

  • median – (bool) Estimates median of values in segments.

  • stdev – (bool) Estimates standard deviation of values in segments.

  • linreg – (bool) Estimates linear regression of values in segments.

set_input_tiername_segments(tiername)[source]

Fix the name of the tier with segments.

Parameters

tiername – (str) Default is ‘TokensAlign’

set_input_tiername_values(tiername)[source]

Fix the name of the tier with values.

Parameters

tiername – (str) Default is ‘PitchTier’

set_segments_separators(entry)[source]

Fix the separators to create segments.

Parameters

entry – (str) Entries separated by whitespace.

set_sgmt_prefix_label(prefix)[source]

Fix the prefix to add to each segment.

Parameters

prefix – (str) Default is ‘sgmt_

tier_to_labelled_segments(segments, input_tier_values)[source]

Create the segment intervals within the values.

Parameters
  • segments – (sppasTier) segment intervals to get values

  • input_tier_values – (sppasTier) tags are float/int values

Returns

(dict, sppasTier) dict of segment/values, labelled segments

tier_to_segments(input_tier)[source]

Create segment intervals.

Parameters

input_tier – (sppasTier)

Returns

(sppasTier)