########################################################## # after-LTS-word-extractor.praat ( Written by Kyuchul Yoon kyoon@ling.osu.edu # This script extracts the after.LTS token string from the LTS scheme output ########################################################## form Specify files and folders word inFolder festival.output.temp.treatment word inFileExt_(with_dot) .textonly.afterLTS word outFolder_(to_be_created) pre.TextGrid word outFileExt_(with_dot) .LTS.out endform # Make a list of files Create Strings as file list... fileList 'inFolder$'\*'inFileExt$' Sort numFiles = Get number of strings pause 'numFiles' files identified. Continue? # Create a subdirectory system mkdir 'outFolder$' # Loop through each file for iFile to numFiles select Strings fileList fileName$ = Get string... iFile filePrefix$ = fileName$ - inFileExt$ outFile$ = filePrefix$ + outFileExt$ Read Strings from raw text file... 'inFolder$'\'fileName$' Rename... strTextonly numLines = Get number of strings for iLine to numLines strLine$ = Get string... iLine indexOfRtParen = index(strLine$, ")") beforeRtParen$ = left$(strLine$, (indexOfRtParen-1)) lenBeforeRtParen = length(beforeRtParen$) targetString$ = right$(beforeRtParen$, (lenBeforeRtParen-2)) fileappend 'outFolder$'\'outFile$' 'targetString$''newline$' endfor select Strings strTextonly Remove #pause Check before continuing to the next file endfor select Strings fileList Remove ############### END OF SCRIPT #################