This repository contains Python scripts for generating and modifying Praat TextGrid
files.
The most elaborate script is TextGrid_script.py
, which is based on CSVtoTextGrid.py
.
TextGrid_script.py
is used in a project which involves using the online forced alignment app Autophon. The script is thus an example of how to operationalise project specific tasks.
This repository is made public in a preliminary state, and will be dynamic during the project period. Still, feel free to raise issues, create forks and/or make pull requests.
The script enables the user to generate TextGrid
files based on data contained within an input CSV file.
It also here presupposes that the corresponding audio files already are located within a folder, from which the audio file duration is extracted per file. This step can be replaced with other code for instance if the input CSV file already contains this information.
The script enables the user to modify pre-existing TextGrid
files. It adds and/or manipulates IntervalTier
and PointTier
object variables.
It also features translation of realization
labels in Norwegian into English via Google Translate (with googletrans
: Translator
).
CSVtoTextGrid.py
is the precursor to TextGrid_script.py
and was originally used to generate TextGrids for longer audio files per participant.
(A related version of the script can be found in my answer to a question on Stack Exchange about how to populate Praat TextGrid tiers based on another text file.)
An adapted version of this script can be relevant to use when you do not require to modify pre-existing TextGrids, or other more complex operations.
Please consider citing or acknowledging the repository/code if you have found it useful. For example like this:
Tengesdal, Eirik. 2024. TextGrid-scripts [Software]. https://github.com/EirikTengesdal/TextGrid-scripts
The repository was first published on GitHub 07.05.2024 (DD.MM.YYYY).
© 2024 Eirik Tengesdal
Licensed under the MIT License.
Eirik Tengesdal
Assistant Professor of Norwegian
Department of Early Childhood Education (BLU)
OsloMet – Oslo Metropolitan University
[email protected]
Guest Researcher of Linguistics
Department of Linguistics and Scandinavian Studies (ILN)
University of Oslo
[email protected]