SequenceTier

sequences.tiers.SequenceTier(self, tier=SequenceList(), entry_class=None)

A sequence tier

Given a praatio IntervalTier or list of Intervals, creates entry_class instances for every interval.

In addition to the attributes and methods described below, the attributes and methods from TierMixins and WithinMixins are also available.

Parameters

Name Type Description Default
tier list[Interval] | list[SequenceInterval] | IntervalTier | Self A list of interval entries. Defaults to SequenceList(). SequenceList()
entry_class Type[SequenceInterval] The sequence class for this tier. Defaults to SequenceInterval. None

Examples

from aligned_textgrid import SequenceInterval, Word, SequenceTier

the = Word((0,1, "the"))
dog = Word((0,1,"dog"))

word_tier = SequenceTier([the, dog])

print(word_tier)
Sequence tier of Word; .superset_class: Top_wp; .subset_class: Phone
print(word_tier.sequence_list)
[Class Word, label: the, .superset_class: Top_wp, .super_instance, None, .subset_class: Phone, Class Word, label: dog, .superset_class: Top_wp, .super_instance, None, .subset_class: Phone]

Attributes

Name Type Description
sequence_list SequenceList[SequenceInterval] A SequenceList of intervals in the tier.
entry_class Type[SequenceInterval] The entry class of the tier
superset_class Type[SequenceInterval] The superset class of the tier
subset_class Type[SequenceInterval] The subset class of the tier
starts np.ndarray[np.float64] An array of start times for all intervals
ends np.ndarray[np.float64] An array of end times for all intervals
labels list[str] A list of the labels of all intervals
xmin float The minimum start time of the tier
xmax float The minumum end time of the tier
name str The name of the tier
[] Indexable. Returns a SequenceInterval
Iterable

Methods

Name Description
cleanup Insert empty intervals where there are gaps in the existing tier.
get_interval_at_time Gets interval index at specified time
pop Pop an interval
return_tier Returns a praatio interval tier
save_as_tg Saves as a textgrid

cleanup

sequences.tiers.SequenceTier.cleanup()

Insert empty intervals where there are gaps in the existing tier.

get_interval_at_time

sequences.tiers.SequenceTier.get_interval_at_time(time)

Gets interval index at specified time

Parameters

Name Type Description Default
time float time at which to get an interval required

Returns

Type Description
int Index of the interval

pop

sequences.tiers.SequenceTier.pop(entry)

Pop an interval

Parameters

Name Type Description Default
entry SequenceInterval Interval to pop required

return_tier

sequences.tiers.SequenceTier.return_tier()

Returns a praatio interval tier

Returns

Type Description
praatio.data_classes.interval_tier.IntervalTier A praatio interval tier. Useful for saving results back as a Praat TextGrid.

save_as_tg

sequences.tiers.SequenceTier.save_as_tg(save_path)

Saves as a textgrid

Uses praatio.data_classes.textgrid.Textgrid.save() method.

Parameters

Name Type Description Default
save_path str Output path required

Reuse

GPLv3