tg.duplicateTierMergeSegments: tg.duplicateTierMergeSegments

Description Usage Arguments Details Value See Also Examples

View source: R/tg.R

Description

Duplicate tier originalInd and merge segments (according to the pattern) to the new tier with specified index newInd (existing tiers are shifted). Typical use: create new syllable tier from phone tier. It merges phones into syllables according to separators in pattern.

Usage

1
2
3
4
5
6
7
8
tg.duplicateTierMergeSegments(
  tg,
  originalInd,
  newInd = Inf,
  newTierName,
  pattern,
  sep = "-"
)

Arguments

tg

TextGrid object

originalInd

tier index or "name"

newInd

new tier index (1 = the first, Inf = the last [default])

newTierName

name of the new tier

pattern

merge segments pattern for the new tier (e.g., "he-llo-world")

sep

separator in pattern (default: "-")

Details

Note 1: there can be segments with empty labels in the original tier (pause), do not specify them in the pattern

Note 2: if there is an segment with empty label in the original tier in the place of separator in the pattern, the empty segment is duplicated into the new tier, i.e. at the position of the separator, there may or may not be an empty segment, if there is, it is duplicated. And they are not specified in the pattern.

Note 3: if the segment with empty label is not at the position corresponding to separator, it leads to error - the part specified in the pattern between separators cannot be split by empty segments

Note 4: beware of labels that appear empty but they are not (space, new line character etc.) - these segments are handled as classical non-empty labels. See example - one label is " ", therefore it must be specified in the pattern.

Value

TextGrid object

See Also

tg.duplicateTier, tg.setTierName, tg.removeTier

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
tg <- tg.sample()
tg <- tg.removeTier(tg, "syllable")
collapsed <- paste0(tg$phone$label, collapse = "")  # get actual labels
print(collapsed)  # all labels in collapsed form - copy the string, include separators -> pattern
pattern <- "ja:-ci-P\\ek-nu-t_so-?u-J\\e-la:S- -nej-dP\\i:f-naj-deZ-h\\ut_S-ku-?a-?a-ta-ma-na:"
tg2 <- tg.duplicateTierMergeSegments(tg, "phone", 1, "syll", pattern, sep = "-")
## Not run: 
tg.plot(tg)
tg.plot(tg2)

## End(Not run)

rPraat documentation built on Feb. 28, 2021, 1:06 a.m.