将 .txt 中的文本加载到 praat 信息 window

load text from .txt into praat info window

我想从 praat window 中的文本文件中读取信息。我可以 "echo" 向 window 发短信:

writeInfoLine: "Hello World"
appendInfoLine: "Goodbye"

但我不知道该怎么做,如果我有

"Hello World"
"Goodbye"

保存到一个简单的 .txt 文件

我想将此文件的内容加载到 Praat Info window 并将其保存到另一个 .txt

您可以将纯文本读入 Strings 对象,然后根据需要操作字符串。

Read Strings from raw text file: "text.txt"
numberOfStrings = Get number of strings

for stringNumber from 1 to numberOfStrings
     string$ = Get string: stringNumber
     appendInfoLine: string$
endfor

您可以使用 appenFileLine: "output.txt", string$ 写入文本文件。

除了调试之外,通常有 0 个理由使用信息 window。

在这种情况下,如果您想要使用 Praat 将内容从一个文件复制到另一个文件,您可以使用 readFile()writeFile():

writeFile: target$, readFile$(source$)

另一方面,如果您想要将文本文件转储到信息 window,则不需要遍历 Strings 对象:

writeInfo: readFile$(source$)