##################################################################################### # Designated splitter in interval tier : Written by Kyuchul Yoon ( kyoon@ling.osu.edu ) # Splits designated word into their component (also designated) morphemes # e.g. iss-eo ==> iss eo # N.B. Word should be an interval by itself, not part of the interval text # (Cf. designated-splitter-part01.praat) # Directory structure for this script should be like the following # root\ : Script should be here # 302000.txt\TextGridDone # 302002.txt\TextGridDone # 302004.txt\TextGridDone # .... # The filename of the output files are .desig.split ##################################################################################### form Select files word subFolderToProcess 303010.txt\TextGridDone word fileExtOfDoneFiles TextGrid.done.com.1.2.3.4.5.6.7.8.9.10.11.12.13.14 word outputFileExt 15 word wordToSplit iss-eu-na word compWord1 iss word compWord2 eu-na word howManySplitted data.txt endform # Get the list of filenames of TextGrid.done files Create Strings as file list... fileList 'subFolderToProcess$'\*.'fileExtOfDoneFiles$' numFiles = Get number of strings # Loop throught each file for iFile to numFiles select Strings fileList # Get the name for a TextGrid.done file doneFile$ = Get string... iFile Read from file... 'subFolderToProcess$'\'doneFile$' # Initialize the number of words splitted iNumSplitted = 0 # Get the number of intervals from the first tier (word tier), # i.e. get the number of eojeols (=numIntervals) numIntervals = Get number of intervals... 1 # Get rid of the leading/following label newNumIntervals = numIntervals - 2 # Initialize counter for eojeols that have been increased by splitting iDynEojeol = 1 # Loop through each interval (eojeol) and split the eojeol for iEojeol to newNumIntervals # Counter for the real location of eojeols considering the increase by splitting iRealEojeol = iEojeol + iDynEojeol # Get the interval text (i.e., eojeol text), excluding the label intervalText$ = Get label of interval... 1 (iRealEojeol+1) # leftEojeol$ = intervalText$ - sylToSplit$ if (wordToSplit$ = intervalText$) # Get the starting and end point of the interval startPointInterval = Get starting point... 1 (iRealEojeol+1) endPointInterval = Get end point... 1 (iRealEojeol+1) midPointInterval = startPointInterval + (endPointInterval - startPointInterval)/2 # Increase the number of words splitted by one iNumSplitted = iNumSplitted + 1 # Get rid of "-" from sylToSplit$ # rightEojeol$ = sylToSplit$ - "-" # totNum = length(sylToSplit$) # newNum = totNum - 1 # rightEojeol$ = right$(sylToSplit$, newNum) # Insert a boundary in the middle and set the text for the right half Insert boundary... 1 midPointInterval Set interval text... 1 (iRealEojeol+1) 'compWord1$' Set interval text... 1 (iRealEojeol+2) 'compWord2$' # Increase the counter only when there are wordToSplit$ words iDynEojeol = iDynEojeol + 1 else endif endfor Write to text file... 'subFolderToProcess$'\'doneFile$'.'outputFileExt$' Remove fileappend 'subFolderToProcess$'\'howManySplitted$' 'doneFile$''tab$''iNumSplitted''newline$' endfor ### END OF SCRIPT ###