From 5b8c9982d206b90eb6efa4deb07115a2e025876b Mon Sep 17 00:00:00 2001 From: Rob van Son Date: Mon, 30 Jul 2007 17:42:21 +0200 Subject: [PATCH] Added a praat script to count the errors in the log file --- SGC_ToneProt/log/printPerformance.praat | 90 +++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 SGC_ToneProt/log/printPerformance.praat diff --git a/SGC_ToneProt/log/printPerformance.praat b/SGC_ToneProt/log/printPerformance.praat new file mode 100644 index 0000000..8180c7e --- /dev/null +++ b/SGC_ToneProt/log/printPerformance.praat @@ -0,0 +1,90 @@ +#!praat +# +# Reads logFile.txt and counts the errors: +# Wrong, High, Narrow, and any of these +# Prints out the counts, total and error rate +# +# Splits out the results for today, if present. + +Read Strings from raw text file... ./logFile.txt +Rename... logFile +istring = Get number of strings + +wrong = 0 +high = 0 +narrow = 0 +totalError = 0 +total = 0 + +wrongToday = 0 +highToday = 0 +narrowToday = 0 +totalErrorToday = 0 +totalToday = 0 + +today$ = date$() +today$ = left$(today$, 10)+" [0-9 :]+ "+right$(today$, 4) + +for i from 1 to istring + select Strings logFile + currentString$ = Get string... 'i' + if not startsWith(currentString$, "\#") + total += 1 + wrong += startsWith(currentString$, "Wrong") + if rindex(currentString$, "High") > 0 + high += 1 + endif + if rindex(currentString$, "Narrow") > 0 + narrow += 1 + endif + if startsWith(currentString$, "Wrong") or rindex(currentString$, "High") > 0 or rindex(currentString$, "Narrow") > 0 + totalError += 1 + endif + + # Today + if rindex_regex(currentString$, today$) > 0 + totalToday += 1 + wrongToday += startsWith(currentString$, "Wrong") + if rindex(currentString$, "High") > 0 + highToday += 1 + endif + if rindex(currentString$, "Narrow") > 0 + narrowToday += 1 + endif + if startsWith(currentString$, "Wrong") or rindex(currentString$, "High") > 0 or rindex(currentString$, "Narrow") > 0 + totalErrorToday += 1 + endif + endif + endif +endfor +select Strings logFile +Remove + + +correct = total - totalError +rate = 0 +if total > 0 + rate$ = fixed$((totalError/total)*100, 2) +endif +clearinfo + +# Print results for today +if totalToday > 0 + printline Today 'today$' + printline Wrong: 'wrong' + printline High: 'high' + printline Narrow: 'narrow' + printline W+H+N: 'totalError' + printline Responses: 'total' + printline Error rate: 'rate$'% + printline +endif + +printline Total +printline Wrong: 'wrong' +printline High: 'high' +printline Narrow: 'narrow' +printline W+H+N: 'totalError' +printline Responses: 'total' +printline Error rate: 'rate$'% +printline -- 2.11.4.GIT