- Timestamp:
- 05/29/08 23:01:55 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Trunk/Scripts/Audio_scripts/AudioSegmentation/AudioBook.pm
r2595 r2597 27 27 =head1 DESCRIPTION 28 28 29 This program segments a speech audio file into 15 word (on average) speech segments. It is executable from the command line and uses30 the following configuration options to help in segmenting speech:29 This is a command line program that segments a speech audio file into 15 word (on average) speech segments. 30 It is executable from the command line and uses the following configuration options to help in segmenting speech: 31 31 32 32 -a * audio file name (WAV format only) … … 144 144 my $username = $self->{"username"}; 145 145 my $tarSuffix = $self->{"tarSuffix"}; 146 my $ voxforgeDict = $self->{"voxforgeDict"};146 my $pronDict = $self->{"pronDict"}; 147 147 my $htk_files = $self->{'htk_files'}; 148 148 my $log = $self{'log'}; 149 my $dict = "AudioBook/interim_files/dict"; 150 my $originalDict = "AudioBook/interim_files/originalDict"; 151 my $prompts = "AudioBook/interim_files/prompts"; 152 153 my $tempPronDict = "AudioBook/interim_files/pronDict"; 154 copy($pronDict,$tempPronDict); 149 155 150 156 my $textContents = AudioBook::Text->new($self,$textfile); … … 152 158 153 159 my $dictionary = AudioBook::Dictionary->new($self); 154 my $missingwordfound = $dictionary->findOutOfVocabularyWords($ voxforgeDict,"AudioBook/interim_files/MissingWords");160 my $missingwordfound = $dictionary->findOutOfVocabularyWords($pronDict,"AudioBook/interim_files/MissingWords"); 155 161 if ($missingwordfound) { 156 $dictionary->getPronunciations("AudioBook/interim_files/MissingWords_out"); # uses g2p 157 $dictionary->updatePronDict(); 162 $dictionary->getRecommendedPronunciations("AudioBook/interim_files/MissingWords_out"); # uses g2p 163 $dictionary->updatePronDict($tempPronDict); 164 copy($dict,$originalDict); # save dict before suggested pronunications are added - only need these pronunciations for segmentation of audio 158 165 # need to update dict with missing words 159 166 # can't seem to change default HDMan log file with "-l" parameter 160 $command = ("HDMan -A -D -T 1 -g $htk_files/global.ded -m -w AudioBook/interim_files/wlist -i -l AudioBook/interim_files/dlog AudioBook/interim_files/dict $voxforgeDict"); system($command) == 0 or confess "fullrun $command failed: $?";167 $command = ("HDMan -A -D -T 1 -g $htk_files/global.ded -m -w AudioBook/interim_files/wlist -i -l AudioBook/interim_files/dlog $dict $tempPronDict"); system($command) == 0 or confess "fullrun $command failed: $?"; 161 168 $command = ("mv AudioBook/interim_files/dlog AudioBook/interim_files/logs/dlog2"); print "cmd:$command\n" if $debug; system($command); 162 169 # no longer required$command = ("cp AudioBook/interim_files/MissingWords_out AudioBook/output_files/MissingWords"); print "cmd:$command\n" if $debug; system($command); … … 175 182 if ($self->{"verify_segments"}) { 176 183 $audio->verifySegments; 184 } 185 if ($missingwordfound) { 186 $dictionary->getAlternatePronunciations("AudioBook/interim_files/MissingWords_alt",15); # uses g2p 187 $dictionary->validateAlternatePronunciations($originalDict,$altDict,$prompts); 188 $dictionary->updatePronDict($pronDict); 177 189 } 178 190 if (defined($tarSuffix)){ … … 261 273 =head2 getOptions 262 274 263 Get the user submitted options ('a:b:d:hl:m:p:r:s:t:u:x:q:v :ST')275 Get the user submitted options ('a:b:d:hl:m:p:r:s:t:u:x:q:vST') 264 276 265 277 =cut … … 282 294 if (defined($opt_d)) { 283 295 if (-r $opt_d) { 284 $self->{" voxforgeDict"}=$opt_d;296 $self->{"pronDict"}=$opt_d; 285 297 } else { 286 die "can't open -d" . $self->{" voxforgeDict"} . "\n";298 die "can't open -d" . $self->{"pronDict"} . "\n"; 287 299 } 288 300 } else { 289 $self->{" voxforgeDict"}="AudioBook/input_files/VoxForgeDict";301 $self->{"pronDict"}="AudioBook/input_files/VoxForgeDict"; 290 302 } 291 303 ### Audio Processing … … 360 372 $self->{"textfile"}="AudioBook/test/text-original.txt"; 361 373 $command = ("cp AudioBook/input_files/VoxForgeDict AudioBook/interim_files/VoxForgeDict"); print "cmd:$command\n"; system($command); 362 $self->{" voxforgeDict"}="AudioBook/interim_files/VoxForgeDict";374 $self->{"pronDict"}="AudioBook/interim_files/VoxForgeDict"; 363 375 $self->{"tarSuffix"}=_random_characters(3); 364 376 $self->{"username"}="test"; … … 379 391 print "-h\tshow help\n"; 380 392 print "-l\tLICENSE file (default = AudioBook/input_files/LICENCE)\n"; 381 print "-m\t Maximum sentence length (default = $default_max_sentence_length words)\n";393 print "-m\tTarget maximum sentence length (default = $default_max_sentence_length words)\n"; 382 394 print "-p\tMinimum pause for sentence break (default = $default_min_pause_for_sentence_break in units of 100ns)\n"; 383 395 print "-q\tlog words with single quotes (default = yes)\n"; … … 410 422 print "audiofile:" . $self->{"audiofile"}. "\n"; 411 423 print "textfile:" . $self->{"textfile"}. "\n"; 412 print " voxforgeDict:" . $self->{"voxforgeDict"} . "\n";424 print "pronDict:" . $self->{"pronDict"} . "\n\n"; 413 425 } 414 426