Praat脚本开发:如何去除重音点层的"_"及对应音节
解决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 accent$ != "%" appendInfoLine: syllable$, " ", accent$ endif endfor
关键修改说明:
- 替换了原来注释的条件部分,新增了
if accent$ != "_" and accent$ != "%"判断逻辑:只有当重音标签既不是下划线也不是百分号时,才会把对应的音节和重音标签追加到输出里。 - 运行这个修改后的脚本,就能得到你期望的输出:
"Ra:n H*L "tOm H* gRam L*H "tROts H*L "u: H*L "fEst H*L
内容的提问来源于stack exchange,提问作者dgr379
相关产品推荐
相关产品推荐

