##################################################################################### # Sentence-final period inserter in interval tier : Written by Kyuchul Yoon ( kyoon@ling.osu.edu ) # # 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 .period ##################################################################################### form Select files comment The script inserts a sentence-final period in the first (interval) tier in TextGrid files word subFolderToProcess 303010.txt\TextGridDone word fileExtOfDoneFiles TextGrid.done word periodSymbol PERIOD word outputFileExt period 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$' # 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 the starting and end point of the final interval before the final startPointInterval = Get starting point... 1 (numIntervals-1) endPointInterval = Get end point... 1 (numIntervals-1) midPointInterval = startPointInterval + (endPointInterval - startPointInterval)/2 intervalText$ = Get label of interval... 1 (numIntervals-1) # Insert a boundary in the middle and set the text for the right half Insert boundary... 1 midPointInterval Set interval text... 1 (numIntervals-1) 'intervalText$' Set interval text... 1 numIntervals 'periodSymbol$' Write to text file... 'subFolderToProcess$'\'doneFile$'.'outputFileExt$' endfor ### END OF SCRIPT ###