Topics

editing labels from scripts

Mietta Lennes
 

Hello,

is it possible to add/edit the label of an interval (in a TextGrid or
Interval Tier) with a script? Can I query the label of an interval in
a
script?

Thanks,

Mietta

Paul Boersma <paul.boersma@...>
 

is it possible to add/edit the label of an interval (in a TextGrid or
Interval Tier) with a script? Can I query the label of an interval in
a
script?

Thanks,

Mietta
Query commands existed before, modification commands have been added
in 3.8.69.

Example 1: create a textgrid with one interval tier and one point tier from scratch:

Create TextGrid... 0 3 "words bells" bells
Insert boundary... 1 0.7
Set interval text... 1 1 aaa
Set interval text... 1 2 bbb
Insert point... 2 0.6 qqq
Insert point... 2 1.1 rrr

Example 2: change all labels on tier 1 that are "bbb" into "ddd"

numberOfIntervals = Get number of intervals... 1
for interval to numberOfIntervals
label$ = Get label of interval... 1 interval
if label$ = "bbb"
Set interval text... 1 interval ddd
endif
endfor

--

Paul Boersma
Institute of Phonetic Sciences, University of Amsterdam
Herengracht 338, 1016CG Amsterdam, The Netherlands
http://www.fon.hum.uva.nl/paul/