Praat 脚本删除特定边界

发布于 2025-01-12 19:30:36 字数 198 浏览 0 评论 0原文

我想知道是否有任何 Praat 脚本可以消除特定层中两个特定段之间的边界。

例如,如果 Tier1 包含诸如 cars 之类的单词,并且 Tier2 包含相应的句段 |k|ɑː|r|z|。如何删除相应目录中所有 TextGrid 文件中的例如 r|z 之间的边界?

先感谢您!

I'm wondering if there is any Praat script available that removes boundaries between two specific segments in a specific Tier.

For example, if Tier1 contains a word such as cars, and Tier2 contains the corresponding segments |k|ɑː|r|z|. How can I remove the boundary between, say, r|z in all TextGrid files in the respective directory?

Thank you in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

糖粟与秋泊 2025-01-19 19:30:36

欢迎来到SO。如果您向我们提供一个示例,说明您一直在做什么以及为什么目前不起作用,那么我们会更容易提供帮助。

每个 TextGrid 是否只包含一个单词?如果是这样,请将其添加到循环遍历文件的脚本中。我在一个玩具示例中使用了这个,但是如果包含该组合的单词数量未知,就会出现问题,因为您将更改正在循环的边界数量,并最终尝试读取一个间隔不再存在。

# Check all intervals in segment tier:
        for i from 1 to numberOfIntervals-1
            label$ = Get label of interval... segment_tier 'i'
            if label$ = "z"
                previous_label$ = Get label of interval... segment_tier 'i'-1
                if previous_label$ = "r"
                    selection_start = Get start point: segment_tier, 'i'
                    Remove boundary at time: segment_tier, selection_start
                    numberOfIntervals = numberOfIntervals-1
                endif

                # select the TextGrid so we can iterate to the next interval:
                select TextGrid 'soundname

您还需要在循环到下一个之前保存 TextGrid:

        select TextGrid 'soundname

            endif
        endfor

您还需要在循环到下一个之前保存 TextGrid:



        Save as text file... 'textGrid_directory

            endif
        endfor

您还需要在循环到下一个之前保存 TextGrid:

'soundname endif endfor

您还需要在循环到下一个之前保存 TextGrid:

.TextGrid Remove endif endfor

您还需要在循环到下一个之前保存 TextGrid:

welcome to SO. It would be easier to help if you gave us an example of what you have been working on, and why it is currently not working.

Does every TextGrid only contain one word? If so, add this to the script that loops through the files. I got this to work on a toy example, but a problem will arise if there are an unknown number of words that contain the combination, because you will be changing the number of boundaries that you are looping through and eventually try and read an interval that no longer exists.

# Check all intervals in segment tier:
        for i from 1 to numberOfIntervals-1
            label$ = Get label of interval... segment_tier 'i'
            if label$ = "z"
                previous_label$ = Get label of interval... segment_tier 'i'-1
                if previous_label$ = "r"
                    selection_start = Get start point: segment_tier, 'i'
                    Remove boundary at time: segment_tier, selection_start
                    numberOfIntervals = numberOfIntervals-1
                endif

                # select the TextGrid so we can iterate to the next interval:
                select TextGrid 'soundname

You will also need to save the TextGrid before looping to the next one:

        select TextGrid 'soundname

            endif
        endfor

You will also need to save the TextGrid before looping to the next one:



        Save as text file... 'textGrid_directory

            endif
        endfor

You will also need to save the TextGrid before looping to the next one:

'soundname endif endfor

You will also need to save the TextGrid before looping to the next one:

.TextGrid Remove endif endfor

You will also need to save the TextGrid before looping to the next one:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文