annotations_delete_empty {act}R Documentation

Delete empty annotations

Description

Delete empty annotations in a corpus object. If only certain transcripts or tiers should be affected set the parameter filterTranscriptNames and filterTierNames. In case that you want to select transcripts and/or tiers by using regular expressions use the function act::search_makefilter first.

Usage

annotations_delete_empty(
  x,
  trimBeforeCheck = FALSE,
  filterTranscriptNames = NULL,
  filterTierNames = NULL
)

Arguments

x

Corpus object.

trimBeforeCheck

Logical; if TRUE leading and trailing spaces will be deleted before checking (as a consequence record sets that contain only spaces will be deleted, too).

filterTranscriptNames

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

filterTierNames

Character string; names of the tiers to be included.

Value

Corpus object.

Examples

library(act)

# In the example corpus are no empty annotations.
# Empty annotations are deleted by default when annotation files are loaded.
# So let's first make an empty annotation.

# Check the first annotation in the first transcript
examplecorpus@transcripts[[1]]@annotations$content[[1]]

# Empty the contents of this annotation
examplecorpus@transcripts[[1]]@annotations$content[[1]] <- ""

# Run the function
test <- act::annotations_delete_empty (x=examplecorpus)

# Compare how many data rows are in the first transcript in
# the example corpus and in the newly created test corpus:
nrow(examplecorpus@transcripts[[1]]@annotations)
nrow(test@transcripts[[1]]@annotations)


[Package act version 1.3.1 Index]