Skip to main content

Aligned TextGrid

PyPI Build codecov Maintainability Build Docs DOI

The aligned-textgrid package provides a python interface for representing and operating on TextGrids produced by forced aligners like FAVE or the Montreal Forced Aligner. Classes provided by aligned-textgrid represent hierarchical and precedence relationships among data stored in TextGrid formats allowing for simplified and more accessible analysis of aligned speech data.

Example Use Cases

  • You want to quickly loop through the Phone tier of a Textgrid, and also access information about the word it is a part of.
  • You want to quickly loop over the Word tier of a Textgrid and quickly count how many phones it has.
  • You want to programmatically merge together adjacent Textgrid intervals.

For examples on how to use the pacakge, see the Usage pages.

Installation

To install aligned-textgrid using pip, run the following command in your terminal:

pip install aligned-textgrid

Not another TextGrid implementation

There are several other packages that parse Praat Textgrids, including

aligned-textgrid’s goal is to capture hierarchical and sequential relationships represented in many TextGrids, and to make them easilly accessible to users via an intuitive interface. The goal is that from any arbitrary location within a TextGrid, users can easilly access information with minimally defensive coding.

Example

As an example, we’ll read in a textgrid produced with forced alignment that contains a single speaker with a word and phone tier.

from aligned_textgrid import AlignedTextGrid, Word, Phone
tg = AlignedTextGrid(
    textgrid_path='doc_src/usage/resources/josef-fruehwald_speaker.TextGrid', 
    entry_classes=[Word, Phone]
    )

Then, we can access an arbitrary phone interval.

arbitrary_interval = tg[0].Phone[20]

From this aribitrary interval, we can access information about the intervals preceding and following with the .prev and .fol attributes.

print(arbitrary_interval.prev.label)
print(arbitrary_interval.label)
print(arbitrary_interval.fol.label)
R
EY1
N

We can also access information about the word this interval is nested within with the .inword attribute.

print(arbitrary_interval.inword.label)
raindrops

The object returned by .inword is just another interval, meaning we can access informaton about it’s context with the .prev and .fol attributes as well.

print(arbitrary_interval.inword.prev.label)
print(arbitrary_interval.inword.label)
print(arbitrary_interval.inword.fol.label)
strikes
raindrops
in

For more

You can also directly read up on the function and class references.

Metadata

Release files for aligned_textgrid 0.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aligned_textgrid 0.8.1
File Size Uploaded
aligned_textgrid-0.8.1.tar.gz 46.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aligned_textgrid 0.8.1
File Interpreter ABI Platform
aligned_textgrid-0.8.1-py3-none-any.whl Python 3 none any Details

Total release size: 100.9 kB

Release files / aligned_textgrid-0.8.1.tar.gz

Download URL aligned_textgrid-0.8.1.tar.gz
Size 46.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9961683f3b9a51602fb88662e5fe5681059793a5895398bc61cdb2392c9b7cac
BLAKE2b-256 checksum
How to use checksums
8cd62e8aef1651ee598feedfc5541813d3967807534d4c800ef4a1be2d0cd4d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.12.1 Linux/6.11.0-1018-azure

Release files / aligned_textgrid-0.8.1-py3-none-any.whl

Download URL aligned_textgrid-0.8.1-py3-none-any.whl
Size 54.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
596b7c73796d2599dc4cb670c35f6faa86be83122d7ea869d248f79e29a5f9bc
BLAKE2b-256 checksum
How to use checksums
0529b441ed2e7db9ba86f7fd208f5afe7c8ec994d73cd26e873917cbac35a975
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.12.1 Linux/6.11.0-1018-azure

Release history Release notifications | RSS feed

This release

0.8.1 This release

2 release files

0.8.0

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.7

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page