import_textgrid: Import a single 'Praat' .TextGrid file

View source: R/import_textgrid.R

import_textgridR Documentation

Import a single 'Praat' .TextGrid file

Description

Advice: In most situations it is more convenient to use act::corpus_new, act::corpus_import for importing annotation files.

Usage

import_textgrid(filePath = NULL, fileContent = NULL, transcriptName = NULL)

Arguments

filePath

Character string; input path of a single 'Praat' .TextGrid file.

fileContent

Vector of character strings; contents of a 'Praat' .TextGrid file read with readLines().

transcriptName

Character string; name of the transcript.

Details

Imports the contents of a 'Praat' .TextGrid file and returns a transcript object. The source is either the path to a .TextGrid file or the contents of a .TextGrid file obtained from the @file.content of an existing transcript object by readLines(). If you pass 'fileContent' you need to pass 'transcriptName' as parameter, too.

Please note:

  • Time values of annotations in TextGrids may be below 0 seconds. Negative time values will be recognized corretly in the first place. When exporting transcript object to other formats like 'ELAN' .eaf, 'EXMARaLDA' .exb ect. annotations that are completely before 0 sec will be deleted, annotations that start before but end after 0 sec will be truncated. Please see also the function act::transcripts_cure_single.

  • TextGrids and contained tiers may start and end at different times. These times do not need to match each other. The act package does not support start and end times of TextGrids and tiers and will. The default start of a TextGrid will be 0 seconds or the lowest value in case that annotations start below 0 seconds.

Value

Transcript object.

See Also

corpus_import, corpus_new, import, import_eaf, import_exb, import_rpraat

Examples

library(act)

# Path to the .TextGrid file that you want to read
path <- system.file("extdata", "examplecorpus", "GAT", 
					"ARG_I_PAR_Beto.TextGrid", package="act")

# To import a .TextGrid file of your choice:
## Not run: 
path <- "PATH_TO_AN_EXISTING_TEXTGRID_ON_YOUR_COMPUTER"

## End(Not run)


t <- act::import_textgrid(filePath=path)
t


# Content of a .TextGrid (already read by \code{readLines}), 
# e.g. from an existing transcript object:
mycontent <- examplecorpus@transcripts[[1]]@file.content
t <- act::import_textgrid(fileContent=mycontent, transcriptName="test")
t


act documentation built on June 7, 2023, 6:16 p.m.