TierMixins

mixins.tiermixins.TierMixins()

Methods and attributes for Sequence Tiers

Attributes

Name Type Description
[] indexable and iterable
first SequenceInterval The first entry in the tier.
last SequenceInterval The last entry in the tier.

Methods

Name Description
append Append a new SequenceInterval or Sequence Point to a tier.
concat Horizontally concatenate a new tier.

append

mixins.tiermixins.TierMixins.append(new, re_relate=True)

Append a new SequenceInterval or Sequence Point to a tier.

If the tier is already in a TierGroup, and an appended SequenceInterval already has a subset_list, or super_instance, these will be appended to the appropriate tiers above and below.

Examples

from aligned_textgrid import SequenceTier, TierGroup, Word, Phone

word_tier = SequenceTier([
    Word((0,10, "the"))
])
phone_tier = SequenceTier([
    Phone((0,5,"DH")),
    Phone((5,10, "AH0"))
])

tier_group = TierGroup([word_tier, phone_tier])

dog = Word((10, 25, "dog"))
dog.append(Phone((10,15, "D")))
dog.append(Phone((15, 20, "AO1")))
dog.append(Phone((20,25, "G")))

word_tier.append(dog)

print(phone_tier.labels)
1
Creation of Word and Phone tier containing “the” and its phones.
2
Relating the Word and Phone tiers within a tier group.
3
Creating a Word for “dog” and appending its phones.
4
Appending the “dog” word to the Word tier.
5
The phones of “dog” have been automatically appended to the Phone tier.
['DH', 'AH0', 'D', 'AO1', 'G']

Parameters

Name Type Description Default
new SequenceInterval | SequencePoint The SequenceInterval or SequencePoint object to append required
re_relate bool If the tier is already within a TierGroup, whether or not to re-run tier-relation. Defaults to True. True

concat

mixins.tiermixins.TierMixins.concat(new)

Horizontally concatenate a new tier.

This will horizontally concatenate the new tier onto the existing tier. The time values of new will be rightward shifted according to the end of the original tier.

Parameters

Name Type Description Default
new TierType The tier to concatenate. required

Reuse

GPLv3