From aacf284b9a5a998aa9db4780d4988396fc792dac Mon Sep 17 00:00:00 2001 From: Rob van Son Date: Thu, 6 Aug 2015 11:26:15 +0200 Subject: [PATCH] Translations of Evaluation table --- Config.praat | 12 +++++++-- Data/Evaluation_DE.Table | 4 +++ Data/Evaluation_EN.Table | 4 +++ Data/Evaluation_JA.Table | 4 +++ Data/Evaluation_NL.Table | 4 +++ Data/Evaluation_ZH.Table | 4 +++ Data/Feedback_DE.Table | 1 - Data/Feedback_EN.Table | 1 - Data/Feedback_JA.Table | 1 - Data/Feedback_NL.Table | 1 - Data/Feedback_ZH.Table | 1 - InitialiseSGC2.praat | 69 ++++++++++++++++++++++++++---------------------- sgc2.praat | 52 ++++++++++++++++++++++++++++++++++++ 13 files changed, 119 insertions(+), 39 deletions(-) diff --git a/Config.praat b/Config.praat index bbbf31b..1cf6ba0 100644 --- a/Config.praat +++ b/Config.praat @@ -722,7 +722,11 @@ procedure processConfigOpenPerf .clickX .clickY .pressed$ .openDialogue$ = Get value... '.row' Helptext call convert_praat_to_latin1 '.openDialogue$' .openDialogue$ = convert_praat_to_latin1.text$ - .defaultName$= "Performance.tsv" + if variableExists("eval.performance$") + .defaultName$= "'eval.performance$'.tsv" + else + .defaultName$= "Performance.tsv" + endif if sgc.savePerf$ <> "" .defaultName$= sgc.savePerf$ endif @@ -760,7 +764,11 @@ procedure processConfigSavePerf .clickX .clickY .pressed$ .openDialogue$ = Get value... '.row' Helptext call convert_praat_to_latin1 '.openDialogue$' .openDialogue$ = convert_praat_to_latin1.text$ - .defaultName$= "Performance.tsv" + if variableExists("eval.performance$") + .defaultName$= "'eval.performance$'.tsv" + else + .defaultName$= "Performance.tsv" + endif if sgc.savePerf$ <> "" .defaultName$= sgc.savePerf$ endif diff --git a/Data/Evaluation_DE.Table b/Data/Evaluation_DE.Table index 3c4966c..2bdfe46 100644 --- a/Data/Evaluation_DE.Table +++ b/Data/Evaluation_DE.Table @@ -1,4 +1,6 @@ Label Text +Pinyin Pinyin +Level Stufe Total Total Correct Richtig Problematic Anmerkungen @@ -10,3 +12,5 @@ Wide Weidl\a"ufig Narrow Flach Unknown Unbekannt Commented Comm. +Time Zeit +Performance \U"bungsergebnisse diff --git a/Data/Evaluation_EN.Table b/Data/Evaluation_EN.Table index a4fe52b..56e5c62 100644 --- a/Data/Evaluation_EN.Table +++ b/Data/Evaluation_EN.Table @@ -1,4 +1,6 @@ Label Text +Pinyin Pinyin +Level Level Total Total Correct Correct Problematic Problematic @@ -10,3 +12,5 @@ Wide Wide Narrow Narrow Unknown Unknown Commented Comm. +Time Time +Performance Pronunciation practice results diff --git a/Data/Evaluation_JA.Table b/Data/Evaluation_JA.Table index dcbe639..9cd5356 100644 --- a/Data/Evaluation_JA.Table +++ b/Data/Evaluation_JA.Table @@ -1,4 +1,6 @@ Label Text +Pinyin ピンイン +Level レベル Total 合計 Correct 正解 Problematic 問題あり @@ -10,3 +12,5 @@ Wide 広い Narrow 狭い Unknown 未知 Commented コメント +Time 日時 +Performance 発音練習結果 diff --git a/Data/Evaluation_NL.Table b/Data/Evaluation_NL.Table index f6cd6bf..d4d27f0 100644 --- a/Data/Evaluation_NL.Table +++ b/Data/Evaluation_NL.Table @@ -1,4 +1,6 @@ Label Text +Pinyin Pinyin +Level Niveau Total Totaal Correct Goed Problematic Aanmerkingen @@ -10,3 +12,5 @@ Wide Overdreven Narrow Vlak Unknown Onbekend Commented Opmerk. +Time Tijd +Performance Oefenresultaten diff --git a/Data/Evaluation_ZH.Table b/Data/Evaluation_ZH.Table index c37ba6f..5d23699 100644 --- a/Data/Evaluation_ZH.Table +++ b/Data/Evaluation_ZH.Table @@ -1,4 +1,6 @@ Label Text +Pinyin 拼音 +Level 水平 Total 总计 Correct 正确 Problematic 存在问题 @@ -10,3 +12,5 @@ Wide 宽 Narrow 窄 Unknown 未知 Commented 评语 +Time 时间 +Performance 发音练习的结果 diff --git a/Data/Feedback_DE.Table b/Data/Feedback_DE.Table index 75c9db3..043a8fc 100644 --- a/Data/Feedback_DE.Table +++ b/Data/Feedback_DE.Table @@ -12,4 +12,3 @@ Show Zeige Wort Part Teil Tones T\o"ne InstallUnzip Dateien mit der .sgc und .zip Erweiterung k\o"nnen nur gebraucht werden wenn sie das 7-Zip Programm installiert haben (7-zip.org) -Performance \U"bungsergebnisse diff --git a/Data/Feedback_EN.Table b/Data/Feedback_EN.Table index 35b66c7..35a3533 100644 --- a/Data/Feedback_EN.Table +++ b/Data/Feedback_EN.Table @@ -12,4 +12,3 @@ Show Show word Part Part Tones Tones InstallUnzip Files with .sgc en .zip extensions can only be read when you have installed the 7-Zip application (7-zip.org) -Performance Pronunciation practice results diff --git a/Data/Feedback_JA.Table b/Data/Feedback_JA.Table index e748af6..e955d1f 100644 --- a/Data/Feedback_JA.Table +++ b/Data/Feedback_JA.Table @@ -12,4 +12,3 @@ Show 単語を表示 Part 部分 Tones 声調 InstallUnzip zipで圧縮されている.sgc形式のファイルは7-zip(7-zip.org)がインストールされているときにだけ読み込みことができます。 -Performance 発音練習結果 diff --git a/Data/Feedback_NL.Table b/Data/Feedback_NL.Table index f56c70f..82dcdd1 100644 --- a/Data/Feedback_NL.Table +++ b/Data/Feedback_NL.Table @@ -12,4 +12,3 @@ Show Woord laten zien Part Onderdeel Tones Tonen InstallUnzip Files met .sgc en .zip kunt u alleen lezen als u de 7-Zip applicatie geinstalleerd hebt (7-zip.org) -Performance Oefenresultaten diff --git a/Data/Feedback_ZH.Table b/Data/Feedback_ZH.Table index ce96074..a3ce741 100644 --- a/Data/Feedback_ZH.Table +++ b/Data/Feedback_ZH.Table @@ -12,4 +12,3 @@ Show 显示单词 Part 部分 Tones 声调 InstallUnzip 只有安装了7-zip(7-zip.org)软件后,才可以读出zip压缩形式的.sgc文件。 -Performance 发音练习的结果 diff --git a/InitialiseSGC2.praat b/InitialiseSGC2.praat index ac5f61c..4347741 100644 --- a/InitialiseSGC2.praat +++ b/InitialiseSGC2.praat @@ -36,6 +36,8 @@ logtimeStamp$ = replace_regex$(currentDate$, "[^a-zA-Z0-9\-_]", "-", 0) currentLogDirectory$ = "" feedbackTablePrefix$ = "Feedback" feedbackTableName$ = "" +evaluationTablePrefix$ = "Evaluation" +evaluationTableName$ = "" performanceTableName$ = "Performance" # Define canvas @@ -537,23 +539,21 @@ procedure initialize_toneevaluation_tables endif initialiseSGC2.toneevaluation_table$ = "" # Get the name of the table - call get_feedback_text 'config.language$' Performance - call convert_praat_to_latin1 'get_feedback_text.text$' - performanceTableName$ = convert_praat_to_latin1.text$ - + call get_evaluation_table_labels 'config.language$' + performanceTableName$ = eval.performance$ if sgc.savePerf$ <> "" and fileReadable(sgc.savePerf$) sgc2.performanceTable = Read Table from tab-separated file: sgc.savePerf$ Rename: performanceTableName$ # Check to make sure all columns are initialized, but only if Pinyin exists! select sgc2.performanceTable - .column = Get column index: "Pinyin" + .column = Get column index: eval.pinyin$ if .column <= 0 select sgc2.performanceTable Remove - sgc2.performanceTable = Create Table with column names... "'performanceTableName$'" 0 Pinyin Correct Wrong Total High Low Wide Narrow Unknown Commented Level Time + sgc2.performanceTable = Create Table with column names... "'performanceTableName$'" 0 'eval.pinyin$' 'eval.correct$' 'eval.wrong$' 'eval.total$' 'eval.high$' 'eval.low$' 'eval.wide$' 'eval.narrow$' 'eval.unknown$' 'eval.commented$' 'eval.level$' 'eval.time$' endif - .columnNameList$ = "Correct Wrong Total High Low Wide Narrow Unknown Commented Level Time" + .columnNameList$ = "'eval.correct$' 'eval.wrong$' 'eval.total$' 'eval.high$' 'eval.low$' 'eval.wide$' 'eval.narrow$' 'eval.unknown$' 'eval.commented$' 'eval.level$' 'eval.time$'" while index_regex(.columnNameList$, "\S") .columnNameList$ = replace_regex$(.columnNameList$, "^\s+", "", 1) .columnHeader$ = extractWord$(.columnNameList$, "") @@ -569,32 +569,32 @@ procedure initialize_toneevaluation_tables endwhile else # Create new table - sgc2.performanceTable = Create Table with column names... "'performanceTableName$'" 0 Pinyin Correct Wrong Total High Low Wide Narrow Unknown Commented Level Time + sgc2.performanceTable = Create Table with column names... "'performanceTableName$'" 0 'eval.pinyin$' 'eval.correct$' 'eval.wrong$' 'eval.total$' 'eval.high$' 'eval.low$' 'eval.wide$' 'eval.narrow$' 'eval.unknown$' 'eval.commented$' 'eval.level$' 'eval.time$' endif initialiseSGC2.toneevaluation_table$ = performanceTableName$ - call get_toneevaluation_row Total + call get_toneevaluation_row 'eval.total$' endproc procedure get_toneevaluation_row .pinyin$ select sgc2.performanceTable - .row = Search column... Pinyin '.pinyin$' + .row = Search column... "'eval.pinyin$'" '.pinyin$' if .row < 1 Append row .row = Get number of rows - Set string value... '.row' Pinyin '.pinyin$' - Set numeric value... '.row' Correct 0 - Set numeric value... '.row' Wrong 0 - Set numeric value... '.row' Total 0 - Set numeric value... '.row' High 0 - Set numeric value... '.row' Low 0 - Set numeric value... '.row' Wide 0 - Set numeric value... '.row' Narrow 0 - Set numeric value... '.row' Unknown 0 - Set numeric value... '.row' Commented 0 - Set numeric value... '.row' Level 0 - Set numeric value... '.row' Time 0 - Sort rows... Pinyin - .row = Search column... Pinyin '.pinyin$' + Set string value... '.row' "'eval.pinyin$'" '.pinyin$' + Set numeric value... '.row' 'eval.correct$' 0 + Set numeric value... '.row' 'eval.wrong$' 0 + Set numeric value... '.row' 'eval.total$' 0 + Set numeric value... '.row' 'eval.high$' 0 + Set numeric value... '.row' 'eval.low$' 0 + Set numeric value... '.row' 'eval.wide$' 0 + Set numeric value... '.row' 'eval.narrow$' 0 + Set numeric value... '.row' 'eval.unknown$' 0 + Set numeric value... '.row' 'eval.commented$' 0 + Set numeric value... '.row' 'eval.level$' 0 + Set numeric value... '.row' 'eval.time$' 0 + Sort rows... 'eval.pinyin$' + .row = Search column... "'eval.pinyin$'" '.pinyin$' endif endproc @@ -608,11 +608,11 @@ procedure increment_toneevaluation_in_row .row .column$ Set numeric value... '.row' '.column$' '.tmp' # Set Level - Set string value: .row, "Level", config.strict$ + Set string value: .row, eval.level$, config.strict$ # Set time stamp .dateTime$ = date$() - Set string value: .row, "Time", .dateTime$ + Set string value: .row, eval.time$, .dateTime$ endproc @@ -629,7 +629,7 @@ procedure increment_toneevaluation_value .pinyin$ .column$ .row = get_toneevaluation_row.row call increment_toneevaluation_in_row '.row' '.column$' - call get_toneevaluation_row Total + call get_toneevaluation_row 'eval.total$' .row = get_toneevaluation_row.row call increment_toneevaluation_in_row '.row' '.column$' endproc @@ -640,24 +640,29 @@ procedure add_feedback_to_toneevaluation .table$ .line2$ = Get value... 2 Text .label$ = Get value... 3 Text if .label$ = "6" - .label$ = "Unknown" + .label$ = "'eval.unknown$'" endif .tones$ = replace_regex$(left$(.line1$, rindex(.line1$, ":")), "[^0-9]", "", 0) .recognized$ = replace_regex$(right$(.line1$, length(.line1$)-rindex(.line1$, ":")), "[^0-9]", "", 0) # Set evaluation - call increment_toneevaluation_value 'sgc.pinyin$' Total + call increment_toneevaluation_value 'sgc.pinyin$' 'eval.total$' if .tones$ = .recognized$ - call increment_toneevaluation_value 'sgc.pinyin$' Correct + call increment_toneevaluation_value 'sgc.pinyin$' 'eval.correct$' .result = 1 else - call increment_toneevaluation_value 'sgc.pinyin$' Wrong + call increment_toneevaluation_value 'sgc.pinyin$' 'eval.wrong$' .result = 0 endif if index_regex(.label$, "(Correct|Wrong)") <= 0 + if .label$ = "Correct" + .label$ = eval.correct$ + else + .label$ = eval.wrong$ + endif call increment_toneevaluation_value 'sgc.pinyin$' '.label$' - call increment_toneevaluation_value 'sgc.pinyin$' Commented + call increment_toneevaluation_value 'sgc.pinyin$' 'eval.commented$' .result = 0 endif diff --git a/sgc2.praat b/sgc2.praat index fee9287..ed28377 100644 --- a/sgc2.praat +++ b/sgc2.praat @@ -1988,3 +1988,55 @@ procedure get_feedback_text .language$ .key$ .text$ = expand_praat_variables.text$ endproc + +# Read evaluation table and get keyed text. Only praat converted Text +procedure get_evaluation_text .language$ .key$ + if not endsWith(evaluationTableName$, "_'.language$'") + if evaluationTableName$ <> "" + select Table 'evaluationTableName$' + Remove + endif + call loadTable 'evaluationTablePrefix$'_'.language$' + evaluationTableName$ = selected$("Table") + endif + call findLabel 'evaluationTableName$' '.key$' + .row = findLabel.row + select Table 'evaluationTableName$' + .text$ = Get value... '.row' Text + # Expand variables, eg, 'praatVersion$' + call expand_praat_variables '.text$' + .rawtext$ = expand_praat_variables.text$ + call convert_praat_to_latin1 '.rawtext$' + .text$ = convert_praat_to_latin1.text$ +endproc + +# Read all the relevant evaluation labels and put them in "eval.