voxforge.org
VoxForge Dev
Show
Ignore:
Timestamp:
05/29/08 23:01:55 (6 months ago)
Author:
kmaclean
Message:

AudioSegmentation scripts - Sequitor G2P pronunciation alternatives validation to Audio using HVite Forced Alignment - snapshot

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Trunk/Scripts/Audio_scripts/AudioSegmentation/AudioBook.pm

    r2595 r2597  
    2727=head1 DESCRIPTION 
    2828 
    29 This program segments a speech audio file into 15 word (on average) speech segments.  It is executable from the command line and uses  
    30 the following configuration options to help in segmenting speech: 
     29This is a command line program that segments a speech audio file into 15 word (on average) speech segments.  
     30It is executable from the command line and uses the following configuration options to help in segmenting speech: 
    3131 
    3232        -a      * audio file name (WAV format only) 
     
    144144        my $username = $self->{"username"}; 
    145145        my $tarSuffix = $self->{"tarSuffix"}; 
    146         my $voxforgeDict = $self->{"voxforgeDict"}; 
     146        my $pronDict = $self->{"pronDict"}; 
    147147        my $htk_files = $self->{'htk_files'}; 
    148148        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);   
    149155 
    150156        my $textContents = AudioBook::Text->new($self,$textfile); 
     
    152158         
    153159        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"); 
    155161        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      
    158165                # need to update dict with missing words 
    159166                # 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: $?"; 
    161168                $command = ("mv AudioBook/interim_files/dlog AudioBook/interim_files/logs/dlog2"); print "cmd:$command\n" if $debug; system($command); 
    162169                # no longer required$command = ("cp AudioBook/interim_files/MissingWords_out AudioBook/output_files/MissingWords"); print "cmd:$command\n" if $debug; system($command); 
     
    175182        if ($self->{"verify_segments"}) { 
    176183                $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);          
    177189        }        
    178190        if (defined($tarSuffix)){ 
     
    261273=head2 getOptions  
    262274 
    263 Get the user submitted options ('a:b:d:hl:m:p:r:s:t:u:x:q:v:ST') 
     275Get the user submitted options ('a:b:d:hl:m:p:r:s:t:u:x:q:vST') 
    264276 
    265277=cut 
     
    282294                if (defined($opt_d)) { 
    283295                        if (-r $opt_d) { 
    284                                 $self->{"voxforgeDict"}=$opt_d; 
     296                                $self->{"pronDict"}=$opt_d; 
    285297                        } else { 
    286                                 die "can't open -d" . $self->{"voxforgeDict"} . "\n";  
     298                                die "can't open -d" . $self->{"pronDict"} . "\n";      
    287299                        } 
    288300                } else { 
    289                         $self->{"voxforgeDict"}="AudioBook/input_files/VoxForgeDict";  
     301                        $self->{"pronDict"}="AudioBook/input_files/VoxForgeDict";      
    290302                } 
    291303                ### Audio Processing 
     
    360372                $self->{"textfile"}="AudioBook/test/text-original.txt"; 
    361373                $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"; 
    363375                $self->{"tarSuffix"}=_random_characters(3); 
    364376                $self->{"username"}="test"; 
     
    379391                print "-h\tshow help\n";         
    380392                print "-l\tLICENSE file (default = AudioBook/input_files/LICENCE)\n"; 
    381                 print "-m\tMaximum sentence length (default = $default_max_sentence_length words)\n"; 
     393                print "-m\tTarget maximum sentence length (default = $default_max_sentence_length words)\n"; 
    382394                print "-p\tMinimum pause for sentence break (default = $default_min_pause_for_sentence_break in units of 100ns)\n";              
    383395                print "-q\tlog words with single quotes (default = yes)\n";              
     
    410422        print "audiofile:" . $self->{"audiofile"}. "\n"; 
    411423        print "textfile:" . $self->{"textfile"}. "\n"; 
    412         print "voxforgeDict:" . $self->{"voxforgeDict"} . "\n"; 
     424        print "pronDict:" . $self->{"pronDict"} . "\n\n";       
    413425} 
    414426