########################################################################## # 01.morpheme.identity tier fixer for Wagon: Written by Kyuchul Yoon ( kyoon@ling.osu.edu ) # Fixes the morph identiy tier labels in .wagon.01 files from 01.morpheme.identity\old # The script will read in all the .wagon.01 files one by one from the directory 01.morpheme.identity\old # and write the output files into its parent directory 10.wagon-features\01.morpheme.identity subdirectory. # The filename of the output files are .wagon.01 ########################################################################## form Select files word subFolderToProcess 10.wagon-features\01.morpheme.identity\old word fileExtOfDoneFiles wagon.01 word outputSubFolder 10.wagon-features\01.morpheme.identity integer tierNumToFix 6 endform # Get the list of filenames of TextGrid.lab files Create Strings as file list... fileList 'subFolderToProcess$'\*.'fileExtOfDoneFiles$' Sort numFiles = Get number of strings pause 'numFiles' labeled textgrids identified. Continue? # Loop throught each file for iFile to numFiles select Strings fileList # Get the name for a TextGrid.lab file doneFile$ = Get string... iFile Read from file... 'subFolderToProcess$'\'doneFile$' Rename... textGrid numIntervals = Get number of intervals... 1 ############# Loop through each interval (eojeol) and extract info ############### for iToken from 2 to (numIntervals-1) tempIntervalText$ = Get label of interval... 1 iToken ############### Version 2 of "morpheme identity" tier ######################### #### This revised block will just copy (minus "#" symbol) token/POS pairs to the new tier #### ################################################################# indexOfSharp = index(tempIntervalText$, "#") if indexOfSharp <> 0 intervalText$ = left$(tempIntervalText$, (indexOfSharp-1)) else intervalText$ = tempIntervalText$ endif Set interval text... tierNumToFix iToken 'intervalText$' endfor Edit pause textgrid to be saved. Continue? Write to text file... 'outputSubFolder$'\'doneFile$' Remove endfor select Strings fileList Remove #### END OF SCRIPT ####