Learn R Programming

act (version 1.3.1)

search_cuts_srt: Create .srt subtitles for all search results

Description

Subtitles in 'Subrib Title' .srt format will be created for each search result. The subtitles will be inserted into the column defined in s@cuts.column.srt.

Usage

search_cuts_srt(
  x,
  s,
  cutSpanBeforesec = NULL,
  cutSpanAftersec = NULL,
  outputFolder = NULL,
  speaker.show = TRUE,
  speaker.width = 3,
  speaker.ending = ":"
)

Value

Search object;

Arguments

x

Corpus object.

s

Search object.

cutSpanBeforesec

Double; Start the cut some seconds before the hit to include some context; the default NULL will take the value as set in @cuts.span.beforesec of the search object.

cutSpanAftersec

Double; End the cut some seconds before the hit to include some context; the default NULL will take the value as set in @cuts.span.beforesec of the search object.

outputFolder

Character string; if parameter is not set, the srt subtitles will only be inserted in s@results; if the path to a existing folder is given transcripts will be saved in '.srt' format.

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

Span
If you want to extend the cut before or after each search result, you can modify @cuts.span.beforesec and @cuts.span.aftersec in your search object. If you want to modify the layout of the print transcripts, create a new layout object with mylayout <- methods::new("layout"), modify the settings and pass it as argument l.

Examples

Run this code
library(act)

# Search
mysearch <- act::search_new(examplecorpus, pattern="yo")

# Create srt subtitles for all search results
test <- act::search_cuts_srt (x=examplecorpus, s=mysearch)

# Display srt subtitle of first three results
cat(test@results[1:3, mysearch@cuts.column.srt])

# Create srt subtitle including 1 sec before and 5 sec after
mysearch@cuts.span.beforesec = 1
mysearch@cuts.span.aftersec = 5
test <- act::search_cuts_srt (x=examplecorpus,
								s=mysearch)

# Display srt subtitle of first  results
cat(test@results[1,mysearch@cuts.column.srt])

Run the code above in your browser using DataLab