- Timestamp:
- 05/26/08 09:24:36 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Trunk/Scripts/Audio_scripts/AudioSegmentation/AudioBook/Audio.pm
r2590 r2591 105 105 # AudioBook/interim_files/dict AudioBook/input_files/htk/models/tiedlist 106 106 # AudioBook/interim_files/downsampled.wav 107 $command = ("pwd && HVite -A -D -T 1 -l '*' -a -b SENT-END -m -C $htk_files/wav_config -H $htk_files/models/macros -H $htk_files/models/hmmdefs -m -t 250.0 150.0 1000.0 -I AudioBook/interim_files/words.mlf -i AudioBook/interim_files/aligned.out -S $htk_files/train.scp AudioBook/interim_files/dict $htk_files/models/tiedlist > AudioBook/interim_files/logs/HVite_log"); system($command) == 0 or confess "error: $command failed: $?"; 107 # !!!!!! 108 # $command = ("pwd && HVite -A -D -T 1 -l '*' -a -b SENT-END -m -C $htk_files/wav_config -H $htk_files/models/macros -H $htk_files/models/hmmdefs -m -t 250.0 150.0 1000.0 -I AudioBook/interim_files/words.mlf -i AudioBook/interim_files/aligned.out -S $htk_files/train.scp AudioBook/interim_files/dict $htk_files/models/tiedlist > AudioBook/interim_files/logs/HVite_log"); system($command) == 0 or confess "error: $command failed: $?"; 109 $command = ("pwd && HVite -A -D -T 1 -l '*' -a -b SENT-END -m -C $htk_files/wav_config -H $htk_files/models/macros -H $htk_files/models/hmmdefs -m -t 500.0 150.0 8000.0 -I AudioBook/interim_files/words.mlf -i AudioBook/interim_files/aligned.out -S $htk_files/train.scp AudioBook/interim_files/dict $htk_files/models/tiedlist > AudioBook/interim_files/logs/HVite_log"); system($command) == 0 or confess "error: $command failed: $?"; 110 # !!!!!! 108 111 open (HVite_Log,"AudioBook/interim_files/logs/HVite_log") || confess "error: can't open AudioBook/interim_files/HVite_log: $?"; 109 112 while (my $line = <HVite_Log>) { … … 257 260 print LOG "\tnone\n"; 258 261 } 262 close LOG; 259 263 } 260 264 … … 412 416 sub verifySegments { #public 413 417 my ($self) = @_; 414 my $debug = $self->{"debug"}; 418 my $debug = $self->{"debug"}; 419 my $log = $self->{"log"}; 420 415 421 open(PROMPTS, "<AudioBook/interim_files/prompts") or confess ("cannot open AudioBook/output_files/prompts for output"); 416 422 my @promptScores; … … 418 424 chomp $line; 419 425 my @promptList = split(" ", $line); 420 my $wavfilename = shift(@promptList) . "\.wav"; 426 my $fileID = shift(@promptList); 427 my $wavfilename = $fileID . "\.wav"; 421 428 $self->_createMLFFile(\@promptList); 422 429 #print "Force Align:$wavfilename:@promptList\n"; 423 430 $self->_forceAlignSegment($wavfilename); 424 431 my $avgLogLikelihoodPerFrame = $self->_processHviteLog($wavfilename); 425 push (@promptScores,[$avgLogLikelihoodPerFrame,$ wavfilename,"@promptList"]);432 push (@promptScores,[$avgLogLikelihoodPerFrame,$fileID,"@promptList"]); 426 433 } 427 434 close (PROMPTS); 428 435 close (MLF); 429 436 #my @sortedlist = sort @promptScores; 430 my @sortedlist = sort { $a->[0] cmp $b->[0] } (@promptScores); # reverse sort of 1st element of @promptScores (which is an array of arrays) 431 437 my @sortedlist = sort { $a->[0] cmp $b->[0] } (@promptScores); # sort of 1st element of @promptScores (which is an array of arrays) 438 439 open(LOG,">>$log") or confess ("cannot open $log file"); 440 print LOG "\nprompts with the lowest average log likelihood per frame:\n"; 441 print LOG "\n(confirm anything with an avgloglik of less than 60):\n"; 442 print LOG "---------------------------------------------------------\n"; 443 my $x; 432 444 foreach my $line (@sortedlist) { 433 print "Force Align:$$line[0] $$line[1] $$line[2]\n"; 434 } 435 print "completed\n"; 445 print LOG "$$line[0] $$line[1] $$line[2]\n"; 446 $x++; 447 last if ($x > 15); 448 } 449 close LOG; 436 450 } 437 451