3 # Script to replay the collection of examples in the
4 # logFile.txt as stored in the log/ directory
6 form Please indicate log file, log directory, and the default register
7 sentence logfile logFile.txt
8 sentence data_Source log
9 real default_register 300
10 positive precision_(st) 3
15 exampleChoice$ = "Hum"
18 Read Strings from raw text file... 'logfile$'
20 numberofLines = Get number of strings
24 for i from 1 to numberofLines
26 currentRegister = default_register
27 select Strings LogFile
28 line$ = Get string... 'i'
30 # Skip empty lines and comments
31 if index_regex(line$, "^[ \t]*\#") <= 0 and index_regex(line$, "[a-zA-Z0-9]+") > 0
33 lengthLine = length(line$)
35 currentStretch$ = line$
37 while currentPoint <= lengthLine
38 currentStretch$ = right$(line$, lengthLine - currentPoint + 1)
39 nextSpace = index_regex(currentStretch$, "\t")
41 numFields = numFields + 1
42 field'numFields'$ = currentStretch$
43 currentPoint = lengthLine + 1
45 numFields = numFields + 1
46 field'numFields'$ = left$(currentStretch$, nextSpace-1)
47 currentPoint = currentPoint + nextSpace
51 # Get the relevant information (fields)
53 currentSound$ = field'numFields'$
54 currentRegister = extractNumber(field7$, "")
56 # Play the current sound
57 Open long sound file... 'data_Source$'/'currentSound$'
58 totalDuration = Get total duration
59 Play part... 0.0 'totalDuration'
62 # Start the recognizer
63 execute SGC_ToneProt.praat "'data_Source$'/'currentSound$'" 'pinyin$' 'currentRegister' 'precision' 'exampleChoice$' 'logPerformance'
65 result$ < lastResult.txt
66 result$ = replace_regex$(result$, "[\n]", " ", 0)
69 pause Result - 'result$'
73 select Strings LogFile