tocs_item: Extract TOCS item ID from a TOCS-related file

View source: R/utils.R

tocs_itemR Documentation

Extract TOCS item ID from a TOCS-related file

Description

Extract TOCS item ID from a TOCS-related file

Usage

tocs_item(xs)

is_tocs_item(xs)

tocs_length(xs)

tocs_type(xs)

Arguments

xs

a character vector of filenames (.wav, .TextGrid, .lab files are supported) or a character vector of TOCS item IDs

Value

tocs_item() returns the item ID, is_tocs_item() returns TRUE or FALSE, tocs_length() returns the length of item (1 to 7 words), tocs_type() returns "single-word" for 1-word "WT" items and "multiword" for "S" items with a length greater than 1.

Examples

x <- c(
  "XXv17_SLOW_s4T06.TextGrid",
  "XXv14_SLOW_s5T04.TextGrid",
  "XXv16s6T06.TextGrid",
  "XX(b)v16s7T03.TextGrid",
  "XXv15_SLOW_s2T01.TextGrid",
  "XXv18wT11.wav",
  "XXv16s7T06.lab",
  "XXv15s5T06.lab",
  "XXv13s3T10.WAV",
  "XXv16S2T09.wav",
  # note that these are bad
  "XXv1_W09.wav",  # no "T"
  "XXv1_S109.wav", # no "T"
  "XXv1_S1T09.wav" # no 1-word S items
)

tocs_item(x)
is_tocs_item(tocs_item(x))
tocs_length(x)
tocs_type(x)

tjmahr/wisclabread documentation built on March 30, 2022, 3:53 a.m.