From faba1df3bfb628a7d922bc6fbf4d9407cc931a32 Mon Sep 17 00:00:00 2001 From: Rob van Son Date: Sat, 1 Nov 2014 10:38:05 +0100 Subject: [PATCH] Simplified recognition by taking only a single 6-6 contour. Also extended recognition to first two syllables of longer sequences --- ToneProt/ToneScript.praat | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/ToneProt/ToneScript.praat b/ToneProt/ToneScript.praat index 149a613..1cc84b2 100644 --- a/ToneProt/ToneScript.praat +++ b/ToneProt/ToneScript.praat @@ -115,11 +115,11 @@ procedure toneScript toneScript.inputWord$ toneScript.upperRegister toneScript.r toneScript.lowerBound = 0 endif if rindex(toneScript.generate$, "Correct") <= 0 - for toneScript.first from toneScript.lowerBound to 6 + for toneScript.first from toneScript.lowerBound to 4 toneScript.currentWord$ = replace_regex$(toneScript.inputWord$, "^([^\d]+)([\d]+)(.*)$", "\1'toneScript.first'\3", 1) - for toneScript.second from 0 to 6 + for toneScript.second from 0 to 4 if (toneScript.first <> 5 and toneScript.second <> 5) and (toneScript.syllableCount > 1 or toneScript.second == 1) - toneScript.currentWord$ = replace_regex$(toneScript.currentWord$, "^([^\d]+)([\d]+)([^\d]+)([\d]+)$", "\1'toneScript.first'\3'toneScript.second'", 1) + toneScript.currentWord$ = replace_regex$(toneScript.currentWord$, "^([^\d]+)([\d]+)([^\d]+)([\d]+)(.*)$", "\1'toneScript.first'\3'toneScript.second'\5", 1) # Write name in list toneScript.wordNumber = toneScript.wordNumber+1 if toneScript.createToneList = 1 @@ -138,6 +138,29 @@ procedure toneScript toneScript.inputWord$ toneScript.upperRegister toneScript.r endif endfor endfor + + # 6,6 + toneScript.first = 6 + toneScript.currentWord$ = replace_regex$(toneScript.inputWord$, "^([^\d]+)([\d]+)(.*)$", "\1'toneScript.first'\3", 1) + toneScript.second = 6 + if toneScript.syllableCount > 1 + toneScript.currentWord$ = replace_regex$(toneScript.currentWord$, "^([^\d]+)([\d]+)([^\d]+)([\d]+)(.*)$", "\1'toneScript.first'\3'toneScript.second'\5", 1) + # Write name in list + toneScript.wordNumber = toneScript.wordNumber+1 + if toneScript.createToneList = 1 + select Table ToneList + toneScript.listLength = Get number of rows + toneScript.listLength = toneScript.listLength + 1 + for toneScript.currLength from toneScript.listLength to toneScript.wordNumber + Append row + Set string value... 'toneScript.currLength' Word ------EMPTY + endfor + Set string value... 'toneScript.wordNumber' Word 'toneScript.currentWord$' + endif + + # Actually, generate something + endif + call generateWord 'toneScript.generate$' 'toneScript.currentWord$' 'toneScript.upperRegister' else call generateWord 'toneScript.generate$' 'toneScript.inputWord$' 'toneScript.upperRegister' endif -- 2.11.4.GIT