Praat脚本:如何摆脱" _"重音层和信息窗口中相应的音节?

时间:2018-01-07 10:12:22

标签: praat

我有一个显示重音的点数层。我也有一个音节层。我需要用相应的重音提取音节层的标签。我唯一不需要的是提取标签" _"和"%"在重音层。

到目前为止我的代码:

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

1 个答案:

答案 0 :(得分:1)

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