annotations.Align.models package

Subpackages

Submodules

annotations.Align.models.modelsexc module

filename

sppas.src.annotations.Align.models.modelsexc.py

author

Brigitte Bigi

contact

develop@sppas.org

summary

Exceptions for Alignment ‘models’ package.

exception annotations.Align.models.modelsexc.ArpaFileError(line)[source]

Bases: OSError

:ERROR 7210:.

Expected a standard arpa file. Error with line: {line}.

__init__(line)[source]
exception annotations.Align.models.modelsexc.MioEncodingError(filename, error_name)[source]

Bases: UnicodeDecodeError

:ERROR 7500:.

The file {!s:s} contains non UTF-8 characters: {:s}.

__init__(filename, error_name)[source]
exception annotations.Align.models.modelsexc.MioFileError(name)[source]

Bases: OSError

:ERROR 7515:.

No model found or empty model in {!s:s}.

__init__(name)[source]
exception annotations.Align.models.modelsexc.MioFileFormatError(name)[source]

Bases: OSError

:ERROR 7505:.

Fail formats: unrecognized file format {!s:s}.

__init__(name)[source]
exception annotations.Align.models.modelsexc.MioFolderError(folder)[source]

Bases: OSError

:ERROR 7510:.

Fail formats: the folder {!s:s} does not contain a known model.

__init__(folder)[source]
exception annotations.Align.models.modelsexc.ModelsDataTypeError(data_name, expected_type, data_type)[source]

Bases: TypeError

:ERROR 7010:.

Expected a {data_name} of type {expected_type}. Got {data_type} instead.

__init__(data_name, expected_type, data_type)[source]
exception annotations.Align.models.modelsexc.NgramCountValueError(min_value, got_value)[source]

Bases: ValueError

:ERROR 7120:.

Expected a minimum count value of {min_value}. Got {got_value} instead.

__init__(min_value, got_value)[source]
exception annotations.Align.models.modelsexc.NgramMethodNameError(got_name)[source]

Bases: NameError

:ERROR 7130:.

Expected a known name of the method. Got {got_name} instead.

__init__(got_name)[source]
exception annotations.Align.models.modelsexc.NgramOrderValueError(min_value, max_value, got_value)[source]

Bases: ValueError

:ERROR 7110:.

Expected an ngram order value between {min_value} and {max_value}. Got {got_value} instead.

__init__(min_value, max_value, got_value)[source]

annotations.Align.models.tiermapping module

filename

sppas.src.annotations.Align.models.tiermapping.py

author

Brigitte Bigi

contact

develop@sppas.org

summary

Map tags of annotated tiers.

class annotations.Align.models.tiermapping.sppasMappingTier(dict_name=None)[source]

Bases: sppas.src.resources.mapping.sppasMapping

Map content of annotations of a tier from a mapping table.

A conversion table is used to map symbols of labels of a tier with new symbols. This class can convert either individual symbols or strings of symbols (syllables, words, …) if a separator is given.

Any symbols in the transcription tier which is not in the conversion table is replaced by a specific symbol (by default ‘*’).

__init__(dict_name=None)[source]

Create a sppasMappingTier instance.

Parameters

dict_name – (str) The mapping dictionary.

get_delimiters()[source]

Return the list of delimiters.

map_annotation(annotation)[source]

Run the mapping process on an annotation.

Parameters

annotation – (sppasAnnotation) annotation with symbols to map

Returns

a new annotation, with the same ‘id’ as the given one

map_label(label)[source]

Run the mapping process on a label.

Parameters

label – (sppasLabel) label with symbols to map

Returns

sppasLabel()

map_tag(tag)[source]

Run the mapping process on a tag.

Parameters

tag – (sppasTag) tag with symbols to map

Returns

List of sppasTag()

map_tier(tier)[source]

Run the mapping process on an input tier.

Parameters

tier – (sppasTier) The tier instance to map label symbols.

Returns

a new tier

set_delimiters(delimit_list)[source]

Fix the list of characters to be used as symbol delimiters.

If delimit_list is an empty list, the mapping system will map with a longest matching algorithm.

Parameters

delimit_list – List of characters, for example [” “, “.”, “-“]

set_map_symbols(value)[source]

Define if symbols have to be mapped or not.

Parameters

value – (bool)

Module contents