voxforge.org
VoxForge Dev
Show
Ignore:
Timestamp:
05/15/08 10:44:44 (8 months ago)
Author:
kmaclean
Message:

AudioSegmentation script - alpha release

Files:

Legend:

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

    r2585 r2586  
    3838        $self{'htk_files'} = $super->{'htk_files'}; 
    3939        $self{'g2p_model'} = $super->{'g2p_model'}; 
     40        $self{'log'} = $super->{'log'};  
    4041        bless(\%self,$class); 
    4142        return \%self; 
     
    5253        $self->{"missing_words"} = $missing_words; 
    5354          
    54         $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: $?";  
    55         open(DLOG,"AudioBook/interim_files/dlog") or confess ("cannot open AudioBook/interim_files/dlog file"); 
     55        $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: $?"; 
     56        my $dlog1 = "AudioBook/interim_files/logs/dlog1"; 
     57        $command = ("mv AudioBook/interim_files/dlog $dlog1"); print "cmd:$command\n" if $debug; system($command); 
     58        open(DLOG,$dlog1) or confess ("cannot open $dlog1 file"); 
    5659        open(MISSINGWORDS,">$missing_words") or confess ("cannot open $missing_words file"); 
    5760        my $missingwordsheader = 0; 
     
    8285sub getPronunciations { # public  
    8386        my ($self,$missing_words_out)= @_; 
    84         my $debug = $self->{"debug"}; 
     87        my $debug = $self->{'debug'}; 
    8588        my $model = $self->{'g2p_model'}; 
    86         my $missing_words = $self->{"missing_words"}; 
     89        my $missing_words = $self->{'missing_words'}; 
     90        my $log = $self->{'log'}; 
    8791 
    8892        $self->{"missing_words_out"} = $missing_words_out; 
     
    9498        } 
    9599        open(MISSINGWORDSOUT,">$missing_words_out") or confess ("cannot open $missing_words_out file"); 
     100        open(LOG,">>$log") or confess ("cannot open $log file"); 
     101        print LOG "\nMissing Words added to Pronunciation Dictionary:\n";        
     102        print LOG "------------------------------------------------\n";          
    96103        my ($word, $phonemes); 
    97104        format MISSINGWORDSOUT = 
     105@<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     106$word,"[" . $word ."]",$phonemes 
     107. 
     108        format LOG = 
    98109@<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    99110$word,"[" . $word ."]",$phonemes 
     
    104115                $phonemes = join(" ",@line); 
    105116                write MISSINGWORDSOUT; 
     117                write LOG;               
    106118        } 
     119        close MISSINGWORDSOUT; 
     120        close LOG; 
    107121        return 1; 
    108122}