tg.boundaryMagnet: tg.boundaryMagnet

Description Usage Arguments Value See Also Examples

View source: R/tg.R

Description

Aligns boundaries of intervals in the target tier (typically: "word") to the closest boundaries in the pattern tier (typically: "phone"). If there is no boundary within the tolerance limit in the pattern tier, the boundary position in the target tier is kept at its original position.

Usage

1
2
3
4
5
6
7
tg.boundaryMagnet(
  tg,
  targetTier,
  patternTier,
  boundaryTolerance = Inf,
  verbose = TRUE
)

Arguments

tg

TextGrid object

targetTier

index or "name" of the tier to be aligned

patternTier

index or "name" of the pattern tier

boundaryTolerance

if there is not any boundary in the pattern tier within this tolerance, the target boundary is kept at its position [default: Inf]

verbose

if TRUE, every boundary shift is printed [default: TRUE]

Value

TextGrid object

See Also

tg.insertBoundary, tg.insertInterval, tg.duplicateTier

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
tg <- tg.sample()
tg <- tg.removeTier(tg, "phoneme")
tg <- tg.removeTier(tg, "syllable")
tg <- tg.removeTier(tg, "phrase")

# garble times in "word" tier a little
n <- length(tg$word$label)
deltaT <- runif(n - 1, min = -0.01, max = 0.015)
tg$word$t2[1: (n-1)] <- tg$word$t2[1: (n-1)] + deltaT
tg$word$t1[2: n] <- tg$word$t2[1: (n-1)]
tg.plot(tg)

# align "word" tier according to "phone tier"
tg2 <- tg.boundaryMagnet(tg, targetTier = "word", patternTier = "phone")
tg.plot(tg2)

## End(Not run)

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