Praat 脚本:如何去掉重音层中的“_”及其在 Info Window 中的相应音节?

Praat scripting: How to get rid of "_" in accent tier and it's corresponding syllables in Info Window?

我有一个显示口音的点层。我也有一个音节层。我需要提取具有相应重音的音节层的标签。我唯一不需要的是提取重音层中的标签“_”和“%”。

到目前为止我的代码:

writeInfo: ""

selectObject: "TextGrid example"

number = Get number of points: 2 #for the accent tier
for n from 1 to number
accent_time = Get time of point: 2, n
syllable = Get interval at time: 1, accent_time #for the syllable tier
syllable$ = Get label of interval: 1, syllable
accent$ = Get label of point: 2, n
    #if accent$ = "_" and "%"
    #don't append syllable
    #endif
appendInfoLine: syllable$, "       ",accent$
endfor

结果:

"Ra:n       H*L
"tOm       H*
gRam       L*H
"tROts       -
"tROts       H*L
"u:       H*L
"tsjo:n       -
"fEst       H*L

我的目标是:

"Ra:n       H*L
"tOm       H*
gRam       L*H
"tROts       H*L
"u:       H*L
"fEst       H*L
writeInfo: ""

selectObject: "TextGrid example"

number = Get number of points: 2 #for the accent tier
for n from 1 to number
accent_time = Get time of point: 2, n
syllable = Get interval at time: 1, accent_time #for the syllable tier
syllable$ = Get label of interval: 1, syllable
accent$ = Get label of point: 2, n
    if accent$ <> "_" and accent$ <> "%"
        appendInfoLine: syllable$, "       ",accent$
    endif
endfor