get_word_duration.RdThis function collects the start points, end points, and durations of all words (or whatever else is annotated in your relevant TextGrid tier).
get_word_duration(
tg_files,
main_tier,
extra_tier = NULL,
encoding = "auto",
skip = FALSE,
extra_tier_number = 1
)A vector of all TextGrid files you want to include. Typically created with get_corpus_files.
The tier with your relevant intervals, e.g. words. Can be given by its name or by its index.
Optional: Include another tier. This tier will be used in unique identifier creation. Can be given by its name or by its index.
Defaults to UTF-8.
Decides whether the function stops (default) or continues after encountering different numbers of non-empty intervals on main_tier and extra_tier. If set to TRUE it will continue and print files with discrepancies to the console.
In case of multiple tiers with the specified extra_tier name, please choose whether the first, second, or nth interval of the same name should be used. Defaults to 1.
A data frame.
Bořil, T., & Skarnitzl, R. (2016). Tools rPraat and mPraat. In P. Sojka, A. Horák, I. Kopeček, & K. Pala (Eds.), Text, Speech, and Dialogue (pp. 367-374). Springer International Publishing.
if (FALSE) corpus_files <- get_corpus_files(path = "data", "wav")
wd_df <- get_word_duration(tg_files = corpus_files[[2]], main_tier = 1)
#> Error: 'C:/Users/Dominic/Dropbox/HHU_2373/Compounds/CFBSFr/package/CFBSr/CFBSr/data/sentence_1.TextGrid' does not exist.
wd_df <- get_word_duration(tg_files = corpus_files[[2]], main_tier = 1, extra_tier = 2)
#> Error: 'C:/Users/Dominic/Dropbox/HHU_2373/Compounds/CFBSFr/package/CFBSr/CFBSr/data/sentence_1.TextGrid' does not exist.
wd_df <- get_word_duration(tg_files = corpus_files[[2]], main_tier = "word")
#> Error: 'C:/Users/Dominic/Dropbox/HHU_2373/Compounds/CFBSFr/package/CFBSr/CFBSr/data/sentence_1.TextGrid' does not exist.
wd_df <- get_word_duration(tg_files = corpus_files[[2]], main_tier = "word", extra_tier = "ID")
#> Error: 'C:/Users/Dominic/Dropbox/HHU_2373/Compounds/CFBSFr/package/CFBSr/CFBSr/data/sentence_1.TextGrid' does not exist.