- Timestamp:
- 05/25/08 20:14:38 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Trunk/Scripts/Audio_scripts/AudioSegmentation/AudioBook.pm
r2589 r2590 30 30 use Getopt::Std; 31 31 use File::Basename; 32 use File::Copy; 32 33 use lib '/home/kmaclean/VoxForge-dev/Main/Scripts/Audio_scripts/AudioSegmentation'; 33 34 use AudioBook::Audio; … … 37 38 ### Class Variables 38 39 #################################################################### 39 our($opt_a,$opt_ d,$opt_h,$opt_l,$opt_m,$opt_p,$opt_r,$opt_s,$opt_t,$opt_x,$opt_S,$opt_T,$opt_u); # need to define these because using strict.40 our($opt_a,$opt_b,$opt_d,$opt_h,$opt_l,$opt_m,$opt_p,$opt_r,$opt_s,$opt_t,$opt_x,$opt_q,$opt_S,$opt_T,$opt_u); # need to define these because using strict. 40 41 my %self; 41 42 $self{'debug'} = 0; … … 85 86 } else { 86 87 open(LOG,">>$log") or confess ("cannot open AudioBook/output_files/MissingWords file"); 87 print LOG "\nMissing Words added to Pronunciation Dictionary:\n";88 print LOG "\nMissing Words that need to be added to Pronunciation Dictionary, with suggested pronunciations::\n"; 88 89 print LOG "------------------------------------------------\n"; 89 90 print LOG "no missing words\n"; … … 93 94 my $audio = AudioBook::Audio->new($self); 94 95 $audio->segment($audiofile,$textContents); 96 $audio->verifySegments; 95 97 if (defined($tarSuffix)){ 96 98 _createTarFile($self); … … 106 108 unlink (<AudioBook/interim_files/logs/*>); 107 109 } 110 if (defined(<AudioBook/interim_files/wav/*>)) { 111 unlink (<AudioBook/interim_files/wav/*>); 112 } 108 113 if (defined(<AudioBook/output_files/wav/*>)) { 109 114 unlink (<AudioBook/output_files/wav/*>); … … 127 132 $mday = sprintf("%02d", $mday); 128 133 print "creating gzipped tar file:$username\-$year$mon$mday\-$tarSuffix\.tgz \n"; 129 $command = ("cp $readme AudioBook/output_files/README"); print "cmd:$command\n" if $debug; system($command); 130 $command = ("cp $license AudioBook/output_files/LICENSE"); print "cmd:$command\n" if $debug; system($command); 134 # !!!!!! 135 #$command = ("cp $readme AudioBook/output_files/README"); print "cmd:$command\n" if $debug; system($command); 136 if (defined($readme)) { 137 copy("$readme","AudioBook/output_files/README"); 138 } else { 139 print "Warning: no README file to copy\n"; 140 } 141 #$command = ("cp $license AudioBook/output_files/LICENSE"); print "cmd:$command\n" if $debug; system($command); 142 if (defined($license)) { 143 copy("$license","AudioBook/output_files/LICENSE"); 144 } else { 145 print "Warning: no LICENSE file to copy\n"; 146 } 147 $command = ("cp AudioBook/interim_files/wav/* AudioBook/output_files/wav/"); print "cmd:$command\n" if $debug; system($command); 148 # !!!!!! 131 149 if ($debug) { 132 150 $command = ("tar -zcvf $username\-$year$mon$mday\-$tarSuffix\.tgz AudioBook/output_files --exclude \"\.svn\" "); print "cmd:$command\n" if $debug; system($command); … … 150 168 my ($self)= @_; 151 169 my $debug = $self->{'debug'}; 152 getopts('a: d:hl:m:p:r:s:t:u:x:ST'); # sets $opt_* as a side effect.170 getopts('a:b:d:hl:m:p:r:s:t:u:x:q:ST'); # sets $opt_* as a side effect. 153 171 if ($opt_a and $opt_t) { 154 172 if (-r $opt_a) { … … 186 204 } else { 187 205 $self->{"min_pause_for_sentence_break"}= $default_min_pause_for_sentence_break; 188 } 206 } 207 if ($opt_q) { 208 if (($opt_q eq "no") or ($opt_q eq "No") or ($opt_q eq "NO")){ 209 $self->{"log_single_quotes"}= 0; 210 } else { 211 $self->{"log_single_quotes"}= 1; 212 } 213 } else { 214 $self->{"log_single_quotes"}= "yes"; 215 } 216 if ($opt_b) { 217 $self->{"beam_width"}=$opt_b; 218 } else { 219 $self->{"beam_width"}=250; 220 } 189 221 ### Tar file processing 190 222 if (defined($opt_T)) { … … 233 265 print "=============================================\n"; 234 266 print "-a\t* audio file name (WAV format only)\n"; 267 print "-b\tbeam width for Forced Alignment with HVit (default = 250)\n"; 235 268 print "-d\tpronunciation dictionary (default = AudioBook/input_files/VoxforgeDict)\n"; 236 269 print "-h\tshow help\n"; … … 238 271 print "-m\tMaximum sentence length (default = $default_max_sentence_length words)\n"; 239 272 print "-p\tMinimum pause for sentence break (default = $default_min_pause_for_sentence_break in units of 100ns)\n"; 240 print "-r\tREADME file (default = AudioBook/input_files/README)\n"; 273 print "-q\tlog words with single quotes (default = yes)\n"; 274 print "-r\tREADME file (default = AudioBook/input_files/README)\n"; 241 275 print "-s\tAverage sentence length (default = $default_average_sentence_length words)\n"; 242 276 print "-t\t* text file name\n";