From 034b5deb238940f395698953bd8dddb7c3d55478 Mon Sep 17 00:00:00 2001 From: Rob van Son Date: Wed, 24 Jan 2018 16:21:01 +0100 Subject: [PATCH] Moving to variable wordlist column names --- Config.praat | 62 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/Config.praat b/Config.praat index c784a9c..ba14be5 100644 --- a/Config.praat +++ b/Config.praat @@ -923,7 +923,7 @@ procedure load_word_list .localdir$ .relnumber endif # Handle (legacy) simple word lists elsif fileReadable("'.dirString$'/wordlist.txt") - Create Table with column names... "'wordlistName$'" 0 Pinyin Character Sound Translation + Create Table with column names: wordlistName$, 0, "'sgcwordlist.word$' 'sgcwordlist.graph$' 'sgcwordlist.audio$' 'sgcwordlist.transl$'" wordlist$ = selected$("Table") Read Strings from raw text file... '.dirString$'/wordlist.txt Rename... RawWordList @@ -976,10 +976,10 @@ procedure load_word_list .localdir$ .relnumber endif select Table 'wordlist$' Append row - Set string value... '.i' Pinyin '.currentPinyin$' - Set string value... '.i' Sound '.currentFile$' - Set string value... '.i' Character '.currentChar$' - Set string value... '.i' Translation '.currentTrans$' + Set string value: .i, sgcwordlist.word$, .currentPinyin$ + Set string value: .i, sgcwordlist.audio$, .currentFile$ + Set string value: .i, sgcwordlist.graph$, .currentChar$ + Set string value: .i, sgcwordlist.transl$, .currentTrans$ endfor select Strings RawWordList Remove @@ -1000,8 +1000,8 @@ procedure load_word_list .localdir$ .relnumber select Table 'wordlist$' Append row .i += 1 - Set string value... '.i' Pinyin '.currentPinyin$' - Set string value... '.i' Sound '.currentFile$' + Set string value: .i, sgcwordlist.word$, .currentPinyin$ + Set string value: .i, sgcwordlist.audio$, .currentFile$ endif endfor select Strings RawWordList @@ -1040,14 +1040,14 @@ procedure load_word_list .localdir$ .relnumber if not .characterColumn Append column... Character for .i to sgc.numberOfWords - Set string value... '.i' Character - + Set string value: .i, sgcwordlist.graph$, "-" endfor endif .translationColumn = Get column index... Translation if not .translationColumn Append column... Translation for .i to sgc.numberOfWords - Set string value... '.i' Translation - + Set string value: .i, sgcwordlist.transl$, "-" endfor endif .translationColumn = Get column index... Sound @@ -1112,27 +1112,27 @@ procedure load_word_list .localdir$ .relnumber if .numLists <= 0 wordlistName$ = wordlistName$+" No Word Lists available" wordlistNum = 1 - Create Table with column names... "'wordlistName$'" 1 Pinyin Character Translation Sound + Create Table with column names: wordlistName$, 1, "'sgcwordlist.word$' 'sgcwordlist.graph$' 'sgcwordlist.audio$' 'sgcwordlist.transl$'" wordlist$ = selected$("Table") .i = 0 Append row .i += 1 - Set string value... '.i' Pinyin ni3hao3 - Set string value... '.i' Character 你好 - Set string value... '.i' Translation hello - Set string value... '.i' Sound - + Set string value: .i, sgcwordlist.word$, "ni3hao3" + Set string value: .i, sgcwordlist.graph$, "你好" + Set string value: .i, sgcwordlist.transl$, "hello" + Set string value: .i, sgcwordlist.audio$, "-" Append row .i += 1 - Set string value... '.i' Pinyin xie4xie0 - Set string value... '.i' Character 谢谢 - Set string value... '.i' Translation thanks - Set string value... '.i' Sound - + Set string value: .i, sgcwordlist.word$, "xie4xie0" + Set string value: .i, sgcwordlist.graph$, "谢谢" + Set string value: .i, sgcwordlist.transl$, "thanks" + Set string value: .i, sgcwordlist.audio$, "-" Append row .i += 1 - Set string value... '.i' Pinyin zai4jian4 - Set string value... '.i' Character 再见 - Set string value... '.i' Translation goodbye - Set string value... '.i' Sound - + Set string value: .i, sgcwordlist.word$, "zai4jian4" + Set string value: .i, sgcwordlist.graph$, "再见" + Set string value: .i, sgcwordlist.transl$, "goodbye" + Set string value: .i, sgcwordlist.audio$, "-" # Get rid of empty first row Remove row: 1 @@ -1166,7 +1166,7 @@ procedure read_wordlist .wordlistName$ .dirString$ endif # Handle (legacy) simple word lists elsif fileReadable("'.dirString$'/wordlist.txt") - .wordlistID = Create Table with column names... "'.wordlistName$'" 0 Pinyin Character Sound Translation + .wordlistID = Create Table with column names: wordlistName$, 0, "'sgcwordlist.word$' 'sgcwordlist.graph$' 'sgcwordlist.audio$' 'sgcwordlist.transl$'" .wordlist$ = selected$("Table") Read Strings from raw text file... '.dirString$'/wordlist.txt Rename... RawWordList @@ -1219,10 +1219,10 @@ procedure read_wordlist .wordlistName$ .dirString$ endif select .wordlistID Append row - Set string value... '.i' 'sgcwordlist.word$' '.currentPinyin$' - Set string value... '.i' 'sgcwordlist.audio$' '.currentFile$' - Set string value... '.i' 'sgcwordlist.graph$' '.currentChar$' - Set string value... '.i' 'sgcwordlist.transl$' '.currentTrans$' + Set string value: .i, sgcwordlist.word$, .currentPinyin$ + Set string value: .i, sgcwordlist.audio$, .currentFile$ + Set string value: .i, sgcwordlist.graph$, .currentChar$ + Set string value: .i, sgcwordlist.transl$, .currentTrans$ endfor select Strings RawWordList Remove @@ -1243,8 +1243,8 @@ procedure read_wordlist .wordlistName$ .dirString$ select sgc.currentWordlist Append row .i += 1 - Set string value... '.i' Pinyin '.currentPinyin$' - Set string value... '.i' Sound '.currentFile$' + Set string value: .i, sgcwordlist.word$, .currentPinyin$ + Set string value: .i, sgcwordlist.audio$, .currentFile$ endif endfor select .tmp @@ -1532,7 +1532,7 @@ procedure readWordlist .sourceDir$ .file$ # if index(.file$, ".sgc") or index(.file$, ".zip") # if index(.file$, ".sgc") - if index_regex(.wordlistDirectory$, "[^a-zA-Z0-9_\.\- /~\:]") <= 0 and index_regex(.dirname$, "[^a-zA-Z0-9_\.\- ]") <= 0 and not (windows and windowsUnzipCommand$ = "") + if index_regex(.wordlistDirectory$, "[^a-zA-Z0-9_\.\- /~:]") <= 0 and index_regex(.dirname$, "[^a-zA-Z0-9_\.\- ]") <= 0 and not (windows and windowsUnzipCommand$ = "") # Create wordlist directory createDirectory(.wordlistDirectory$) .wasWordList = 1 @@ -1584,7 +1584,7 @@ procedure readWordlist .sourceDir$ .file$ ### REALLY DANGEROUS STUFF, SHOULD BE HANDLED BETTER if .wasWordList = 0 # Remove newly created directory - if index_regex(.wordlistDirectory$, "[^a-zA-Z0-9_\.\- /~\:]") <= 0 and index_regex(.dirname$, "[^a-zA-Z0-9_\.\- ]") <= 0 and index(.dirname$, "..") <= 0 + if index_regex(.wordlistDirectory$, "[^a-zA-Z0-9_\.\- /~:]") <= 0 and index_regex(.dirname$, "[^a-zA-Z0-9_\.\- ]") <= 0 and index(.dirname$, "..") <= 0 if macintosh or unix system bash -rc -- 'rm -r "'.wordlistDirectory$'/"' elsif windows -- 2.11.4.GIT