transcripts_merge2 {act}R Documentation

Merge several transcripts (works with transcript objects directly)

Description

Merges several transcripts. One transcript is the destination transcript (the transcript that will be updated). The other transcripts are the update transcripts and contain the updates. The update transcripts need to contain a tier in which the update sections are marked with a specific character string.

Usage

transcripts_merge2(
  destinationTranscript,
  updateTranscripts,
  identifierTier = "update",
  identifierPattern = ".+",
  eraseUpdateSectionsCompletely = TRUE
)

Arguments

destinationTranscript

Transcript object; transcript that serves as destination (and will receive the updates).

updateTranscripts

List of transcript objects; transcript objects that will be inserted into the destination transcripts (entirely or in part).

identifierTier

Character string; regular expression that identifies the tier in which the sections are marked, that will be inserted into destinationTranscript.

identifierPattern

Character string; regular expression that identifies the sections that will be inserted into destinationTranscript.

eraseUpdateSectionsCompletely

Logical; if TRUE update sections in destination transcript will be erased completely, if FALSE update sections in the destination tier will not be erased completely but only the tiers that are present in the updateTranscripts be erased.

Details

You may chose between the following two options: - The update sections in the destination transcript will first be erased completely and then the updates will be filled in. - The update sections in the destination transcript will NOT be erased completely. Rater only the contents of tiers will be erased that are also present in the update tiers. e.g. if your destination transcript contains more tiers than the update transcripts, the contents of those tiers will be preserved in the destination tier during the update.

Value

Transcript object

See Also

transcripts_merge

Examples

library(act)

# We need three transcripts  to demonstrate the function \code{transcripts_merge}:
# - the destination transcript
destinationTranscript <- 	examplecorpus@transcripts[["update_destination"]]
# - two transcripts that contain updates
updateTranscripts <- 		c(examplecorpus@transcripts[["update_update1" ]],
                           examplecorpus@transcripts[["update_update2" ]])

# Run the function
test <- transcripts_merge2(destinationTranscript, updateTranscripts)

# Save the transcript to a TextGrid file.
# Set the destination file path
path <- tempfile(pattern = "merge_test", tmpdir = tempdir(),
                 fileext = ".TextGrid")

# 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, ".TextGrid", sep=""))

## End(Not run)

# Export
act::export_textgrid( t=test, outputPath=path)


[Package act version 1.1.9 Index]