############################################################ # diphone-all-locator-for-TextGrids.praat ( Written by Kyuchul Yoon kyoon@ling.osu.edu # This script reads existing diphones (2420 diphones) one by one # and for each diphone, 1) gives a list of all the textgrid filenames containing it # and 2) marked.diphones interval numbers ############################################################ form Specify files and folders word diphoneFile 02.all-diphones-in-recordings.one-column.unix-sort-uniq word inFolder lab.TextGrid.after.LTS.scheme.diphone.textgrid word inFileExt_(with_dot) .TextGrid.prosodic.diphone natural diphoneTier 5 natural tierToCreate 6 word tierName marked.diphones word outFolder_(with_diphones_marked) lab.TextGrid.PRAAT.EMU.diphone-labeling word logFile_(list_of_TextGrids) DIPHONES.and.their.TEXTGRID.NAMES.TXT endform # Create a new directory that will hold textgrids with diphones marked #system mkdir 'outFolder$' ############################################### # READ DIPHONE FILE and CREATE A LIST OF ALL TEXTGRIDS ############################################### Read Strings from raw text file... 'diphoneFile$' Rename... diphoneFile Sort Sort numDiphones = Get number of strings pause 'numDiphones' identified. Continue? Create Strings as file list... textgridList 'inFolder$'\*'inFileExt$' Sort Sort numTextgrids = Get number of strings pause 'numTextgrids' identified. Continue? ################## # FOR EACH DIPHONE ################## for iDiphone from 48 to numDiphones # Give user information about which diphone is being processed at what time # fileappend 'userinfo$' Started at'tab$' # system time /T >> 'userinfo$' # system date /T >> 'userinfo$' select Strings diphoneFile diphoneToProcess$ = Get string... iDiphone fileappend 'logFile$' 'diphoneToProcess$''tab$'diphone#'tab$''iDiphone''newline$' for iTextgrid to numTextgrids select Strings textgridList textgridName$ = Get string... iTextgrid Read from file... 'inFolder$'\'textgridName$' Rename... textgridFile numDiphoneIntervals = Get number of intervals... diphoneTier for iInterval from 2 to (numDiphoneIntervals-1) intervalText$ = Get label of interval... diphoneTier iInterval if diphoneToProcess$ = intervalText$ fileappend 'logFile$' 'tab$''textgridName$''tab$''iInterval''newline$' endif endfor select TextGrid textgridFile Remove endfor fileappend 'logFile$' 'newline$' endfor select Strings textgridList plus Strings diphoneFile Remove ################ END OF SCRIPT ##################