0

我正在尝试从一个 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
4

1 回答 1

0

你实际上有两个问题。首先,Set interval text...需要三个参数(层号、间隔号、文本),但您只有两个。您可以看出它需要三个参数,因为当您在“对象”窗口中单击该命令时弹出的表单需要三个参数。其次,你有两个ifs 但只有一个endif

于 2018-02-01T07:06:58.127 回答