export_srt: Export a transcript object to a .srt subtitle file

View source: R/export_srt.R

export_srtR Documentation

Export a transcript object to a .srt subtitle file

Description

Advice: In most situations it is more convenient to use act::corpus_export for exporting annotation files.

Usage

export_srt(
  t,
  outputPath = NULL,
  filterTierNames = NULL,
  filterSectionStartsec = NULL,
  filterSectionEndsec = NULL,
  speaker.show = TRUE,
  speaker.width = 3,
  speaker.ending = ":"
)

Arguments

t

Transcript object; transcript to be saved.

outputPath

Character string; path where .srt will be saved.

filterTierNames

Vector of character strings; names of tiers to be included. If left unspecified, all tiers will be exported.

filterSectionStartsec

Double; start of selection in seconds.

filterSectionEndsec

Double; end of selection in seconds.

speaker.show

Logical; if TRUE name of speaker will be shown before the content of the annotation.

speaker.width

Integer; width of speaker abbreviation, -1 for full name without shortening.

speaker.ending

Character string; string that is added at the end of the speaker name.

Details

Creates a 'Subrip title' .srt subtitle file. It will be written to the file specified in outputPath. If outputPath is left empty, the function will return the contents of the .srt itself.

Value

Contents of the .srt file (only if outputPath is left empty)

See Also

corpus_export, export_eaf, export_exb, export_printtranscript, export_rpraat, export_textgrid

Examples

library(act)

# Get the transcript you want to export
t <- examplecorpus@transcripts[[1]]

# Create temporary file path
path <- tempfile(pattern = t@name, tmpdir = tempdir(),
                 fileext = ".srt")

# It makes more sense, however, to you define a destination folder
# that is easier to access on your computer:
## Not run: 
path <- file.path("PATH_TO_AN_EXISTING_FOLDER_ON_YOUR_COMPUTER",
                    paste(t@name, ".srt", sep=""))

## End(Not run)

# Export
act::export_srt(t=t, outputPath=path)


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