tg.findLabels {rPraat}R Documentation

tg.findLabels

Description

Find label or consecutive sequence of labels and returns their indices.

Usage

tg.findLabels(tg, tierInd, labelVector, returnTime = FALSE)

Arguments

tg

TextGrid object

tierInd

tier index or "name"

labelVector

character string (one label) or vector of character strings (consecutive sequence of labels) to be found

returnTime

If TRUE, return vectors of begin (t1) and end time (t2) for each found group of sequence of labels instead of indices (when FALSE = default).

Value

If returnTime == FALSE, returns list of all occurrences, each member of the list is one occurence and contains vector of label indices, if returnTime == TRUE, returns list witch vectors t1 (begin) and t2 (end) for each found group of sequence of labels.

See Also

tg.countLabels, tg.getLabel, tg.duplicateTierMergeSegments

Examples

tg <- tg.sample()
i <- tg.findLabels(tg, "phoneme", "n")
i
length(i)
i[[1]]
i[[2]]
tg$phoneme$label[unlist(i)]

i <- tg.findLabels(tg, "phone", c("?", "a"))
i
length(i)
tg$phone$label[i[[1]]]
tg$phone$label[i[[2]]]
tg$phone$label[unlist(i)]

t <- tg.findLabels(tg, "phone", c("?", "a"), returnTime = TRUE)
t
t$t2[1] - t$t1[1]   # duration of the first result
t$t2[2] - t$t1[2]   # duration of the second result

i <- tg.findLabels(tg.sample(), "word", c("ti", "reknu", "co"))
i
length(i)
length(i[[1]])
i[[1]]
i[[1]][3]
tg$word$label[i[[1]]]

t <- tg.findLabels(tg.sample(), "word", c("ti", "reknu", "co"), returnTime = TRUE)
pt <- pt.sample()
tStart <- t$t1[1]
tEnd <- t$t2[1]
## Not run: 
pt.plot(pt.cut(pt, tStart, tEnd))

## End(Not run)

[Package rPraat version 1.3.2-1 Index]