tg.findLabels: tg.findLabels

Description Usage Arguments Value See Also Examples

View source: R/tg.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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)

rPraat documentation built on Dec. 9, 2018, 1:04 a.m.