I have a directory dir1 containing several hundreds of files, which are to be iteratively processed by a speech program called HRest. The program is supposed to take each file one by one, process it and put it in a new directory (as dir2 for first iteration) to be used in next iteration. My problem is that i don't know if the way I've employed to loop through the files in dir1, and also the way I am running the script (trainhmms.pl dir1 1) is correct.
If the files in dir1 are L1, L2, L3, ..., L500, I want HRest to be executed as
HRest -T 1 -I timedlabels_train.mlf -t -i 20 -l dir1/L1 -M dir2 -S train.scp
for the first file, and as
HRest -T 1 -I timedlabels_train.mlf -t -i 20 -l dir1/L2 -M dir2 -S train.scp
for the next file, and so on for all files. Then in next call of the script, I want it to be changed to
HRest -T 1 -I timedlabels_train.mlf -t -i 20 -l dir2/L1 -M dir3 -S train.scp
for the first file, and so on..
Here is the script for the first iteration:
#!/usr/bin/perl
use File::Slurp;
# Usage: trainhmms.pl dir1 1
# dir1: Folder containing models after being initialised by HInit (L1,L2,..,L512)
$file = $ARGV[0];
$iter = $ARGV[1];
my @files = read_dir '/Users/negarolfati/Documents/Detection_rerun/AF_TIMIT/1_state//trainHMMs/dir1';
for my $file ( @files ) {
$iter2 = $iter+1;
$cmd = "HRest -T 1 -I timedlabels_train.mlf -t -i 20 -l '$dir[$iter]/$file' -M '$dir[$iter2]' -S train.scp ";
system("$cmd");
}
$dir[$iter]and$dir[$iter2]. They access an array called@dirwhich doesn't exist.