我正在尝试从一个 TextGrid 中读取修改文本并将该文本放入新 TextGrid 的间隔中。当我尝试将其插入新的 TextGrid 时出现错误。我正在寻找由<s/>
and标记的某些文本</s>
。这就是我要写入新 TextGrid 的内容。
Open long sound file... /Summer_recap.wav
To TextGrid... "word"
textGridToWriteTo$ = "Summer_recap"
textGridToReadFrom$ = "Summer_recap_old"
tGrid = Read from file: "Summer_recap_old.TextGrid"
numberOfIntervals = Get number of intervals: 1
for intervalNumber from 1 to numberOfIntervals
text$ = Get label of interval: 1, intervalNumber
if text$ <> ""
head$ = left$ (text$, 4)
tail$ = right$ (text$, 4)
if head$ = "<s/>" and tail$ = "</s>"
startTime = Get start point: 1, intervalNumber
endTime = Get end point: 1, intervalNumber
s$ = replace$ (text$, "<s/>", "", 1)
s$ = replace$ (s$, "</s>", "", 1)
select TextGrid 'textGridToWriteTo$'
Insert boundary... 1 startTime
# below is where the error occurs
Set interval text... 1 'test$'
Insert boundary... 1 endTime
select TextGrid 'textGridToReadFrom$'
endif
endfor