##################################################################################### # AP boundary log creator script: Written by Kyuchul Yoon ( kyoon@ling.osu.edu ) # Script should be in the parent directory where 30[23]00[024].txt/ folders belong. # A subdirectory should be TextGridDone/. # The script assumes that you already have the TextGrid files labelled by a professional K-ToBI labeler. # The script will read in all the .done files one by one from TextGridDone/ directory # and write AP boundary log files into APLog/ directory. # The filename of the output AP boundary Log files are ...ap ##################################################################################### # Specify files and folders form Select files word longSoundFolder_(should_be_a_subfolder) 303010.txt word doneFilesSubFolder TextGridDone word fileExtOfDoneFiles_(without_dot) done word apLogSubFolder APLog endform # Get .done files for loop Create Strings as file list... fileList 'longSoundFolder$'\'doneFilesSubFolder$'\*.'fileExtOfDoneFiles$' numFiles = Get number of strings for iFile to numFiles select Strings fileList # Get the name for .done file doneFile$ = Get string... iFile Read from file... 'longSoundFolder$'\'doneFilesSubFolder$'\'doneFile$' # If an old file exists, delete it first and then write out the log info. filedelete 'longSoundFolder$'\'apLogSubFolder$'\'doneFile$'.ap # Get the number of intervals from the first tier (word tier) numIntervals = Get number of intervals... 1 # Loop through each interval (eojeol) and output that with its AP boundary log to a file in another folder for iEojeol to numIntervals # Get the interval text intervalText$ = Get label of interval... 1 iEojeol # Get end time of the eojeol which will be used to extract # the corresponding point from the second tier (phonology) endInterval = Get end point... 1 iEojeol # Put down the interval text first fileappend 'longSoundFolder$'\'apLogSubFolder$'\'doneFile$'.ap ... 'intervalText$' # Get the number of points from the second tier (phonology tier) numPoints = Get number of points... 2 # Loop through all the points to extract the one point that corresponds to # the end time of the interval from word tier for iPoint to numPoints pointLabel$ = Get label of point... 2 iPoint timePoint = Get time of point... 2 iPoint if timePoint = endInterval fileappend 'longSoundFolder$'\'apLogSubFolder$'\'doneFile$'.ap ... 'tab$''pointLabel$' endif endfor fileappend 'longSoundFolder$'\'apLogSubFolder$'\'doneFile$'.ap ... 'newline$' endfor Remove endfor select Strings fileList Remove #### END OF SCRIPT ####