tiers_convert: Convert tiers

View source: R/tiers_convert.R

tiers_convertR Documentation

Convert tiers

Description

Converts tier types between 'interval' and 'point' tier. Applies to all tiers in all transcript objects of a corpus. If only certain transcripts or tiers should be affected set the parameter filterTranscriptNames. In case that you want to select transcripts by using regular expressions use the function act::search_makefilter first.

Usage

tiers_convert(
  x,
  intervalToPoint = FALSE,
  pointToInterval = FALSE,
  filterTierNames = NULL,
  filterTranscriptNames = NULL
)

Arguments

x

Corpus object.

intervalToPoint

Logical; if TRUE interval tiers will be converted to point/text tiers.

pointToInterval

Logical; if TRUE point/text tiers will be converted to interval tiers.

filterTierNames

Vector of character strings; names of the tiers to be included.

filterTranscriptNames

Vector of character strings; names of the transcripts to be checked. If left open, all transcripts will be checked

Details

Note: When converting from interval > point tier, the original end times of the annotations will be lost definitely.

Value

Corpus object.

See Also

tiers_add, tiers_delete, tiers_rename, tiers_sort, helper_tiers_new_table, helper_tiers_sort_table

Examples

library(act)

# Check the names and types of the existing tiers in the first two transcripts
examplecorpus@transcripts[[1]]@tiers
examplecorpus@transcripts[[2]]@tiers

# Convert interval tiers to point tiers
newcorpus <- act::tiers_convert(examplecorpus, intervalToPoint=TRUE)

# the names and types of the existing tiers
newcorpus@transcripts[[1]]@tiers
newcorpus@transcripts[[2]]@tiers

# Convert point tiers to interval tiers
newcorpus <- act::tiers_convert(newcorpus, pointToInterval=TRUE)

# Note: In this round trip conversion from 'interval > point > interval tier' 
# the original end times of the annotations get lost (when converting from interval > point).

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