Commit 135404bcf3b764441731134b9822b01a6e4902f0
1 parent
1fd315c89e
Exists in
master
Modify verbose and log system into FirstPass.sh
Showing 4 changed files with 135 additions and 69 deletions Side-by-side Diff
main_tools/FirstPass.sh
... | ... | @@ -33,7 +33,8 @@ |
33 | 33 | then |
34 | 34 | . $FIRSTPASS_CONFIG_FILE |
35 | 35 | else |
36 | - echo "ERROR : Can't find configuration file $FIRSTPASS_CONFIG_FILE" >&2 | |
36 | + echo "ERROR : Can't find configuration file $FIRSTPASS_CONFIG_FILE" > /dev/stderr | |
37 | + echo "exit" > /dev/stderr | |
37 | 38 | exit 1 |
38 | 39 | fi |
39 | 40 | |
... | ... | @@ -49,7 +50,7 @@ |
49 | 50 | echo -e "\t\t-h :\tprint this message" |
50 | 51 | echo -e "\t\t-D :\tDEBUG mode on" |
51 | 52 | echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode" |
52 | - echo -e "\t\t-c :\tCheck process, stop if error detected" | |
53 | + echo -e "\t\t-c :\tCheck process, and log it into files, can stop if error detected" | |
53 | 54 | echo -e "\t\t-f n :\tspecify a speeral forks number (default 1)" |
54 | 55 | echo -e "\t\t-r :\tforce rerun the wav file" |
55 | 56 | exit 1 |
... | ... | @@ -112,8 +113,8 @@ |
112 | 113 | # wav filename without extension |
113 | 114 | BASENAME=${FILENAME%.*} |
114 | 115 | |
115 | - print_info "=> $BASENAME P1 | $(date +'%d/%m/%y %H:%M:%S')" 1 | |
116 | - print_info "$WAV_FILE OK" 1 | |
116 | + print_info "[${BASENAME}] => P1 start | $(date +'%d/%m/%y %H:%M:%S')" 1 | |
117 | + print_info "[${BASENAME}] $WAV_FILE OK" 2 | |
117 | 118 | else |
118 | 119 | print_error "can't find $1 OR file is empty" |
119 | 120 | exit 1 |
... | ... | @@ -123,7 +124,7 @@ |
123 | 124 | if [ ! -e $2 ] |
124 | 125 | then |
125 | 126 | mkdir -p $2 |
126 | - print_info "Make directory $2" 1 | |
127 | + print_info "[${BASENAME}] Make directory $2" 2 | |
127 | 128 | fi |
128 | 129 | |
129 | 130 | |
... | ... | @@ -137,8 +138,8 @@ |
137 | 138 | SEG_FILE="$OUTPUT_DIR_BASENAME/$BASENAME.seg" # Global Seg file |
138 | 139 | LBL_FILE="$OUTPUT_DIR_BASENAME/$BASENAME.lbl" # Global LBL file |
139 | 140 | RES_DIR=$OUTPUT_DIR_BASENAME"/res_p1" |
140 | -LOGFILE="$OUTPUT_DIR/info_p1.log" | |
141 | -ERRORFILE="$OUTPUT_DIR/error_p1.log" | |
141 | +LOGFILE="$OUTPUT_DIR_BASENAME/info_p1.log" | |
142 | +ERRORFILE="$OUTPUT_DIR_BASENAME/error_p1.log" | |
142 | 143 | |
143 | 144 | #------------------# |
144 | 145 | # Create WORKSPACE # |
... | ... | @@ -146,7 +147,7 @@ |
146 | 147 | if [ ! -e $OUTPUT_DIR_BASENAME ] |
147 | 148 | then |
148 | 149 | mkdir -p $OUTPUT_DIR_BASENAME |
149 | - print_info "Make directory $OUTPUT_DIR_BASENAME" 1 | |
150 | + print_info "[${BASENAME}] Make directory $OUTPUT_DIR_BASENAME" 2 | |
150 | 151 | fi |
151 | 152 | |
152 | 153 | # Lock directory |
... | ... | @@ -156,7 +157,7 @@ |
156 | 157 | |
157 | 158 | rm -r $PLP_DIR > /dev/null 2>&1; |
158 | 159 | mkdir -p $PLP_DIR |
159 | -print_info "Make directory $PLP_DIR" 1 | |
160 | +print_info "[${BASENAME}] Make directory $PLP_DIR" 2 | |
160 | 161 | if [ $RERUN -eq 0 ]; |
161 | 162 | then |
162 | 163 | rm -r $RES_DIR > /dev/null 2>&1; |
... | ... | @@ -164,7 +165,8 @@ |
164 | 165 | rm $RES_DIR/*.lock > /dev/null 2>&1 |
165 | 166 | fi |
166 | 167 | mkdir -p $RES_DIR > /dev/null 2>&1 |
167 | -print_info "Make directory $RES_DIR" 1 | |
168 | +print_info "[${BASENAME}] Make directory $RES_DIR" 2 | |
169 | +rm $LOGFILE $ERRORFILE > /dev/null 2>&1 | |
168 | 170 | |
169 | 171 | #--------------------# |
170 | 172 | # Save configuration # |
... | ... | @@ -180,7 +182,7 @@ |
180 | 182 | echo "SEG_FILE=$SEG_FILE" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg |
181 | 183 | echo "LBL_FILE=$LBL_FILE" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg |
182 | 184 | echo "RES_DIR=$RES_DIR" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg |
183 | -print_info "save config in $OUTPUT_DIR_BASENAME/FirstPass.cfg" 1 | |
185 | +print_info "[${BASENAME}] save config in $OUTPUT_DIR_BASENAME/FirstPass.cfg" 1 | |
184 | 186 | |
185 | 187 | #-------------------------# |
186 | 188 | # Check Audio File Format # |
187 | 189 | |
... | ... | @@ -195,12 +197,12 @@ |
195 | 197 | |
196 | 198 | if [ $error -eq 1 ] |
197 | 199 | then |
198 | - print_message $WARNING 2 "$WAV_FILE is not a wav file at 16000 Hz, 1 channel, 16bits\nhave to convert" | |
199 | - print_message $INFO 3 "avconv -i $WAV_FILE -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 $OUTPUT_DIR_BASENAME/$BASENAME.wav" | |
200 | + print_message $WARNING 2 "[${BASENAME}] $WAV_FILE is not a wav file at 16000 Hz, 1 channel, 16bits\nhave to convert" | |
201 | + print_message $INFO 3 "[${BASENAME}] avconv -i $WAV_FILE -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 $OUTPUT_DIR_BASENAME/$BASENAME.wav" | |
200 | 202 | avconv -i $WAV_FILE -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 $OUTPUT_DIR_BASENAME/$BASENAME.wav $REDIRECTION_OUTPUT |
201 | 203 | WAV_FILE=$OUTPUT_DIR_BASENAME/$BASENAME.wav |
202 | 204 | FILENAME=$BASENAME.wav |
203 | - print_message $INFO 1 "new wav file : $WAV_FILE" | |
205 | + print_message $INFO 1 "[${BASENAME}] new wav file : $WAV_FILE" | |
204 | 206 | fi |
205 | 207 | |
206 | 208 | #---------------# |
207 | 209 | |
208 | 210 | |
... | ... | @@ -209,16 +211,15 @@ |
209 | 211 | if [ -s $(dirname $WAV_FILE)/$BASENAME.SRT ] |
210 | 212 | then |
211 | 213 | cp $(dirname $WAV_FILE)/$BASENAME.SRT $OUTPUT_DIR_BASENAME/$BASENAME.SRT |
212 | - print_info "copy $BASENAME.SRT file into workingspace" 1 | |
214 | + print_info "[${BASENAME}] copy $BASENAME.SRT file into $OUTPUT_DIR_BASENAME" 3 | |
213 | 215 | fi |
214 | 216 | |
215 | 217 | #------------# |
216 | 218 | # WAV -> PLP # |
217 | 219 | #------------# |
218 | -print_info "convert WAV -> PLP" 1 | |
220 | +print_info "[${BASENAME}] convert WAV -> PLP" 1 | |
219 | 221 | echo $FILENAME > $OUTPUT_DIR_BASENAME/list.tmp |
220 | -print_info "$BIN_PATH/lia_plp_mt.32 --lst $OUTPUT_DIR_BASENAME/list.tmp --input_dir $(dirname $WAV_FILE) --output_dir $OUTPUT_DIR_BASENAME --input_type WAV --output_type HTK --nb_coef 12 --cms | |
221 | -" 2 | |
222 | +print_info "[${BASENAME}] $BIN_PATH/lia_plp_mt.32 --lst $OUTPUT_DIR_BASENAME/list.tmp --input_dir $(dirname $WAV_FILE) --output_dir $OUTPUT_DIR_BASENAME --input_type WAV --output_type HTK --nb_coef 12 --cms" 3 | |
222 | 223 | |
223 | 224 | $BIN_PATH/lia_plp_mt$ARCH --lst $OUTPUT_DIR_BASENAME/list.tmp --input_dir $(dirname $WAV_FILE) --output_dir $OUTPUT_DIR_BASENAME --input_type WAV --output_type HTK --nb_coef 12 --cms $REDIRECTION_OUTPUT |
224 | 225 | |
... | ... | @@ -227,7 +228,8 @@ |
227 | 228 | check_first_pass_plp "$PLP_FILE" |
228 | 229 | if [ $? -eq 1 ] |
229 | 230 | then |
230 | - echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $PLP_FILE" >> $ERRORFILE | |
231 | + print_log_file "$ERROFILE" "ERROR [$(date +'%d/%m/%y %H:%M:%S')] Creating PLP file : $PLP_FILE" | |
232 | + echo "[${BASENAME}] ERROR : ${BASENAME} check $ERRORFILE file" > /dev/stderr | |
231 | 233 | exit 1 |
232 | 234 | fi |
233 | 235 | fi |
234 | 236 | |
235 | 237 | |
236 | 238 | |
237 | 239 | |
... | ... | @@ -237,27 +239,29 @@ |
237 | 239 | #------------------------------# |
238 | 240 | # S/NS + SPEAKERS SEGMENTATION # |
239 | 241 | #------------------------------# |
240 | -print_info "Launch speakers diarization" 1 | |
242 | +print_info "[${BASENAME}] Launch speakers diarization" 1 | |
241 | 243 | # Calcul seg file |
242 | -print_info "java -Xmx4096m -jar $BIN_PATH/LIUM_SpkDiarization-4.2.jar --fInputMask=${WAV_FILE} --sOutputMask=${SEG_FILE} $BASENAME" 2 | |
244 | +print_info "[${BASENAME}] java -Xmx4096m -jar $BIN_PATH/LIUM_SpkDiarization-4.2.jar --fInputMask=${WAV_FILE} --sOutputMask=${SEG_FILE} $BASENAME" 3 | |
243 | 245 | #java -Xmx8000m -Xms2048 -jar $BIN_PATH/LIUM_SpkDiarization-4.2.jar --fInputMask=${WAV_FILE} --sOutputMask=${SEG_FILE} $BASENAME |
244 | 246 | java -Xmx4096m -jar $BIN_PATH/LIUM_SpkDiarization-4.2.jar --fInputMask=${WAV_FILE} --sOutputMask=${SEG_FILE} $BASENAME $REDIRECTION_OUTPUT #–doCEClustering |
245 | 247 | |
246 | 248 | if [ $CHECK -eq 1 ] && ( [ ! -e $SEG_FILE ] || [ -z $SEG_FILE ] ) |
247 | 249 | then |
248 | - echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $SEG_FILE" >> $ERRORFILE | |
250 | + print_log_file "$ERRORFILE" "ERROR [$(date +'%d/%m/%y %H:%M:%S')] Creating SEG file : $SEG_FILE" | |
251 | + echo "[${BASENAME}] ERROR : check $ERRORFILE file" > /dev/stderr | |
249 | 252 | exit 1 |
250 | 253 | fi |
251 | 254 | |
252 | 255 | |
253 | 256 | # Create LBL file |
254 | -print_info "Extract LBL file from SEG file" 2 | |
257 | +print_info "Extract LBL file from SEG file" 1 | |
255 | 258 | |
256 | 259 | cat $SEG_FILE | grep -v ";;" | cut -f3,4,5,8 -d" " | tr " " "#" | sort -k1 -n | tr "#" " " > $LBL_FILE |
257 | 260 | |
258 | 261 | if [ $CHECK -eq 1 ] && ( [ ! -e $LBL_FILE ] || [ -z $LBL_FILE ] ) |
259 | 262 | then |
260 | - echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $LBL_FILE" >> $ERRORFILE | |
263 | + print_log_file "$ERRORFILE" "ERROR [$(date +'%d/%m/%y %H:%M:%S')] Creating LBL file : $LBL_FILE" | |
264 | + echo "[${BASENAME}] ERROR : check $ERRORFILE file" > /dev/stderr | |
261 | 265 | exit 1 |
262 | 266 | fi |
263 | 267 | |
... | ... | @@ -265,8 +269,8 @@ |
265 | 269 | #----------------------------------------------------# |
266 | 270 | # Cut global PLP file depending to LBL segmentations # |
267 | 271 | #----------------------------------------------------# |
268 | -print_info "Cut PLP file depending to LBL segmentations" 1 | |
269 | -print_info "$BIN_PATH/gcep $PLP_FILE $LBL_FILE 500 $PLP_DIR -FSEG" 2 | |
272 | +print_info "[${BASENAME}] Cut PLP file depending to LBL segmentations" 1 | |
273 | +print_info "[${BASENAME}] $BIN_PATH/gcep $PLP_FILE $LBL_FILE 500 $PLP_DIR -FSEG" 3 | |
270 | 274 | |
271 | 275 | $SPEERAL_TOOLS/gcep $PLP_FILE $LBL_FILE 500 $PLP_DIR -FSEG $REDIRECTION_OUTPUT |
272 | 276 | |
... | ... | @@ -275,7 +279,8 @@ |
275 | 279 | check_first_pass_plps_lbl $PLP_DIR $LBL_FILE |
276 | 280 | if [ $? -eq 1 ] |
277 | 281 | then |
278 | - echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $PLP wrong .plp files number" >> $ERRORFILE | |
282 | + print_log_file $ERRORFILE "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $PLP wrong number of .plp files" | |
283 | + echo "[${BASENAME}] ERROR : check $ERRORFILE file" > /dev/stderr | |
279 | 284 | exit 1 |
280 | 285 | fi |
281 | 286 | fi |
... | ... | @@ -289,7 +294,7 @@ |
289 | 294 | #---------------------------------------------# |
290 | 295 | # PLP files list depending to acoustic models # |
291 | 296 | #---------------------------------------------# |
292 | -print_info "Create PLP list depending of the model" 1 | |
297 | +print_info "[${BASENAME}] Create PLP list depending of the model" 1 | |
293 | 298 | # Create a list of plp files |
294 | 299 | find $PLP_DIR -type f -exec basename "{}" .plp \; | sort > $OUTPUT_DIR_BASENAME/plp.lst |
295 | 300 | |
... | ... | @@ -298,7 +303,7 @@ |
298 | 303 | do |
299 | 304 | a=`grep -e "${MTAG[$i]}" $OUTPUT_DIR_BASENAME/plp.lst` |
300 | 305 | if [ -n "$a" ]; then |
301 | - print_info "$OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst" 3 | |
306 | + print_info "[${BASENAME}] Creating $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst" 3 | |
302 | 307 | grep -e "${MTAG[$i]}" $OUTPUT_DIR_BASENAME/plp.lst | sort > $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst |
303 | 308 | fi |
304 | 309 | done |
... | ... | @@ -310,7 +315,7 @@ |
310 | 315 | # For all AM do decoding |
311 | 316 | # if Check error -> iter on undone decoding (max 1 times) |
312 | 317 | # |
313 | -print_info "Launch decoding" 1 | |
318 | +print_info "[${BASENAME}] Launch decoding" 1 | |
314 | 319 | for (( i=0; $i<${#MTAG[@]} ; i++ )) |
315 | 320 | do |
316 | 321 | redo=1; # nb of try if not all segs is decoded |
... | ... | @@ -319,7 +324,7 @@ |
319 | 324 | todo=$OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst |
320 | 325 | while [ $redo -gt 0 ]; do |
321 | 326 | rm $RES_DIR/*.lock > /dev/null 2>&1 |
322 | - print_info "$SPEERAL_BIN $todo $RES_DIR ${SPEERAL_CFG[$i]} -r $PLP_DIR -m $SPEERAL_AM/${MODS[$i]}.hmm -c $SPEERAL_AM/${MODS[$i]}.cls $FORKS --lock $REDIRECTION_OUTPUT" 2 | |
327 | + print_info "[${BASENAME}] $SPEERAL_BIN $todo $RES_DIR ${SPEERAL_CFG[$i]} -r $PLP_DIR -m $SPEERAL_AM/${MODS[$i]}.hmm -c $SPEERAL_AM/${MODS[$i]}.cls $FORKS --lock $REDIRECTION_OUTPUT" 3 | |
323 | 328 | # Run speeral |
324 | 329 | $SPEERAL_BIN ${todo} $RES_DIR ${SPEERAL_CFG[$i]} -r $PLP_DIR -m $SPEERAL_AM/${MODS[$i]}.hmm -c $SPEERAL_AM/${MODS[$i]}.cls $FORKS --lock $REDIRECTION_OUTPUT |
325 | 330 | |
326 | 331 | |
327 | 332 | |
328 | 333 | |
329 | 334 | |
330 | 335 | |
331 | 336 | |
332 | 337 | |
333 | 338 | |
334 | 339 | |
335 | 340 | |
336 | 341 | |
... | ... | @@ -332,59 +337,64 @@ |
332 | 337 | then |
333 | 338 | # rerun |
334 | 339 | redo=$(($redo - 1)); |
335 | - echo -e "WARN : Speeral output ERROR ${OUTPUT_DIR_BASENAME}/plp_${MODS[$i]}.lst" >> $ERRORFILE | |
340 | + print_warn "[${BASENAME}] Speeral output error : check $LOGFILE" 2 | |
341 | + print_log_file $LOGFILE "WARN : Speeral number of output ERROR ${OUTPUT_DIR_BASENAME}/plp_${MODS[$i]}.lst" | |
336 | 342 | # new plp list |
337 | 343 | # list .seg done and compare to list of seg to do |
338 | 344 | ls $RES_DIR/*.seg | grep -e "${MTAG[$i]}" | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp |
339 | 345 | diff ${OUTPUT_DIR_BASENAME}/plp_${MODS[$i]}.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" > ${OUTPUT_DIR_BASENAME}/todo.lst |
340 | 346 | rm ${OUTPUT_DIR_BASENAME}/.tmp |
341 | 347 | # log seg to do |
342 | - cat ${OUTPUT_DIR_BASENAME}/todo.lst >> $ERRORFILE | |
348 | + print_log_file $LOGFILE "Segs not done :" | |
349 | + cat ${OUTPUT_DIR_BASENAME}/todo.lst >> $LOGFILE | |
343 | 350 | todo=${OUTPUT_DIR_BASENAME}/todo.lst |
344 | - echo -e "WARN : Try $redo" >> $ERRORFILE | |
351 | + print_warn "[${BASENAME}] Try $redo" 3 | |
345 | 352 | fi |
346 | - else | |
347 | - redo=-5; | |
348 | 353 | fi |
349 | 354 | done |
350 | - if [ $redo -eq 0 ] | |
351 | - then | |
352 | - echo -e "ERROR : Speeral $todo" >> $ERRORFILE | |
353 | - cat ${OUTPUT_DIR_BASENAME}/todo.lst >> $ERRORFILE | |
354 | - #exit 1 | |
355 | - fi | |
356 | 355 | rm ${OUTPUT_DIR_BASENAME}/todo.lst > /dev/null 2>&1 |
357 | 356 | #rm $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst |
358 | 357 | rm $RES_DIR/*.lock > /dev/null 2>&1 |
359 | 358 | fi |
360 | 359 | done |
361 | 360 | |
362 | -print_info "<= End P1 $BASENAME | $(date +'%d/%m/%y %H:%M:%S')" 1 | |
363 | - | |
364 | 361 | ## Check missing seg and log it |
365 | -ls $RES_DIR/*.seg | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp | |
366 | -echo -e "$BASENAME P1 END\n[" >> $LOGFILE | |
367 | -diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE | |
368 | -todo=$(cat ${OUTPUT_DIR_BASENAME}/plp.lst | wc -l) | |
369 | -notdone=$(($todo - $(cat ${OUTPUT_DIR_BASENAME}/.tmp | wc -l))) | |
370 | -pourcentage=$((($notdone*100)/$todo)) | |
371 | -echo -e "] $pourcentage% $BASENAME" >> $LOGFILE | |
372 | -rm ${OUTPUT_DIR_BASENAME}/.tmp | |
362 | +if [ $CHECK -eq 1 ] | |
363 | +then | |
364 | + ls $RES_DIR/*.seg | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp | |
365 | + todo=$(cat ${OUTPUT_DIR_BASENAME}/plp.lst | wc -l) | |
366 | + if [ $todo -eq 0 ]; then todo=1;fi | |
367 | + notdone=$(($todo - $(cat ${OUTPUT_DIR_BASENAME}/.tmp | wc -l))) | |
368 | + pourcentage=$((($notdone*100)/$todo)) | |
373 | 369 | |
370 | + if [ $notdone -ne 0 ] | |
371 | + then | |
372 | + print_error "[${BASENAME}] ERROR : check $ERRORFILE" | |
373 | + print_log_file "$ERRORFILE" "ERROR : Segs not done [" | |
374 | + diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $ERROFILE | |
375 | + print_log_file "$ERRORFILE" "] $pourcentage% $BASENAME" | |
376 | + else | |
377 | + print_log_file "$LOGFILE" "P1 OK $BASENAME | $(date +'%d/%m/%y %H:%M:%S')" | |
378 | + fi | |
379 | + rm ${OUTPUT_DIR_BASENAME}/.tmp | |
380 | +fi | |
374 | 381 | |
375 | 382 | #---------------# |
376 | 383 | # Convert res # |
377 | 384 | #---------------# |
378 | - | |
385 | +print_info "[${BASENAME}] Convert .res into .ctm" 1 | |
379 | 386 | # .res => .ctm |
380 | 387 | $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format CTM --ignore $RULES/asupp --out $OUTPUT_DIR_BASENAME/$BASENAME.1pass.ctm $REDIRECTION_OUTPUT |
388 | +print_info "[${BASENAME}] Convert .res into .trs" 1 | |
381 | 389 | # .res => .trs |
382 | 390 | echo -e "name $AUTHOR\nfileName $BASENAME\nfileExt wav\nsegFile $OUTPUT_DIR_BASENAME/$BASENAME.seg" > $OUTPUT_DIR_BASENAME/$BASENAME.trs_cfg |
383 | 391 | $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TRS --ignore $RULES/asupp --out $OUTPUT_DIR_BASENAME/$BASENAME.1pass.trs --trs_config $OUTPUT_DIR_BASENAME/$BASENAME.trs_cfg $REDIRECTION_OUTPUT |
384 | 392 | rm $OUTPUT_DIR_BASENAME/$BASENAME.trs_cfg 2> /dev/null |
393 | +print_info "[${BASENAME}] Convert .res into .txt" 1 | |
385 | 394 | # .res => .txt |
386 | 395 | $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TXT --ignore $RULES/asupp --out $OUTPUT_DIR_BASENAME/$BASENAME.1pass.txt $REDIRECTION_OUTPUT |
387 | 396 | |
397 | +print_info "[${BASENAME}] <= P1 End | $(date +'%d/%m/%y %H:%M:%S')" 1 | |
388 | 398 | # unlock directory |
389 | 399 | mv "$OUTPUT_DIR_BASENAME/FIRSTPASS.lock" "$OUTPUT_DIR_BASENAME/FIRSTPASS.unlock" |
main_tools/OneScriptToRuleThemAll.sh
... | ... | @@ -43,11 +43,18 @@ |
43 | 43 | MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0)) |
44 | 44 | |
45 | 45 | RING="" |
46 | +$p1=0 | |
47 | +$p2=0 | |
48 | +$conf=0 | |
49 | +$exploitconf=0 | |
50 | +$p3=0 | |
51 | +$recompose=0 | |
52 | +$scoring=0 | |
46 | 53 | |
47 | 54 | #---------------# |
48 | 55 | # Parse Options # |
49 | 56 | #---------------# |
50 | -while getopts ":hDv:cf:r" opt | |
57 | +while getopts ":hDv:cf:r123CeRs" opt | |
51 | 58 | do |
52 | 59 | case $opt in |
53 | 60 | h) |
... | ... | @@ -57,8 +64,16 @@ |
57 | 64 | echo -e "\t\t-D :\tDEBUG mode on" |
58 | 65 | echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode" |
59 | 66 | echo -e "\t\t-c :\tCheck process, stop if error detected" |
60 | - echo -e "\t\t-f n :\tspecify a speeral forks number (default 1)" | |
61 | - echo -e "\t\t-r :\tforce rerun the wav file" | |
67 | + echo -e "\t\t-f n :\tSpecify a speeral forks number (default 1)" | |
68 | + echo -e "\t\t-r :\tForce to rerun without deleting all files" | |
69 | + echo -e "\t\t-a :\tDo every pass" | |
70 | + echo -e "\t\t-1 :\tDo 1rt pass" | |
71 | + echo -e "\t\t-2 :\tDo 2nd pass" | |
72 | + echo -e "\t\t-3 :\tDo 3rd pass" | |
73 | + echo -e "\t\t-C :\tDo confidence pass" | |
74 | + echo -e "\t\t-e :\tDo exploit confidence pass (SOLR)" | |
75 | + echo -e "\t\t-R :\tDo recompose res" | |
76 | + echo -e "\t\t-s :\tDo scoring" | |
62 | 77 | exit 1 |
63 | 78 | ;; |
64 | 79 | D) |
... | ... | @@ -76,6 +91,36 @@ |
76 | 91 | r) |
77 | 92 | RING=$RING" -r" |
78 | 93 | ;; |
94 | + a) | |
95 | + p1=1 | |
96 | + p2=1 | |
97 | + p3=1 | |
98 | + conf=1 | |
99 | + exploitconf=1 | |
100 | + recompose=1 | |
101 | + scoring=1 | |
102 | + ;; | |
103 | + 1) | |
104 | + p1=1 | |
105 | + ;; | |
106 | + 2) | |
107 | + p2=1 | |
108 | + ;; | |
109 | + 3) | |
110 | + p3=1 | |
111 | + ;; | |
112 | + C) | |
113 | + conf=1 | |
114 | + ;; | |
115 | + e) | |
116 | + exploitconf=1 | |
117 | + ;; | |
118 | + a) | |
119 | + recompose=1 | |
120 | + ;; | |
121 | + s) | |
122 | + scoring=1 | |
123 | + ;; | |
79 | 124 | :) |
80 | 125 | echo "Option -$OPTARG requires an argument." >&2 |
81 | 126 | exit 1 |
... | ... | @@ -101,14 +146,15 @@ |
101 | 146 | then |
102 | 147 | echo -e "$LORD\n" |
103 | 148 | REP_OUT=$2/${1%.*} |
104 | - ${MAIN_SCRIPT_PATH}/FirstPass.sh ${RING} $1 $2 | |
105 | - ${MAIN_SCRIPT_PATH}/SecondPass.sh ${RING} ${REP_OUT} | |
106 | - ${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p2" | |
107 | - ${MAIN_SCRIPT_PATH}/ExploitConfidencePass.sh ${RING} ${REP_OUT} | |
108 | - ${MAIN_SCRIPT_PATH}/ThirdPass.sh ${RING} ${REP_OUT} | |
109 | - ${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p3" | |
110 | - ${MAIN_SCRIPT_PATH}/RecomposePass.sh ${RING} ${REP_OUT} | |
111 | - ${MAIN_SCRIPT_PATH}/ScoringRes.sh ${RING} ${REP_OUT} | |
149 | + if [ $p1 -eq 1 ];then ${MAIN_SCRIPT_PATH}/FirstPass.sh ${RING} $1 $2;fi | |
150 | + if [ $p2 -eq 1 ];then ${MAIN_SCRIPT_PATH}/SecondPass.sh ${RING} ${REP_OUT};fi | |
151 | + if [ $conf -eq 1 ];then $p${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p2";fi | |
152 | + if [ $exploitconf -eq 1 ]; then ${MAIN_SCRIPT_PATH}/ExploitConfidencePass.sh ${RING} ${REP_OUT};fi | |
153 | + if [ $p3 -eq 1 ];then ${MAIN_SCRIPT_PATH}/ThirdPass.sh ${RING} ${REP_OUT};fi | |
154 | + if [ $conf -eq 1 ];then ${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p3";fi | |
155 | + if [ $recompose -eq 1 ];then ${MAIN_SCRIPT_PATH}/RecomposePass.sh ${RING} ${REP_OUT};fi | |
156 | + if [ $scoring -eq 1 ];then ${MAIN_SCRIPT_PATH}/ScoringRes.sh ${RING} ${REP_OUT};fi | |
157 | + echo "done" | |
112 | 158 | else |
113 | 159 | echo "can't find $1 OR file is empty" |
114 | 160 | exit 1 |
main_tools/SecondPass.sh
... | ... | @@ -170,8 +170,8 @@ |
170 | 170 | done |
171 | 171 | |
172 | 172 | # Check if more then 89% of treil are done |
173 | -nbres_p1=$(ls $RES_DIR_P1/*.res | wc -l) | |
174 | -nbtreil_p2=$(ls $RES_DIR/*.treil | wc -l) | |
173 | +nbres_p1=$(ls $RES_DIR_P1/*.res 2> /dev/null | wc -l) | |
174 | +nbtreil_p2=$(ls $RES_DIR/*.treil 2> /dev/null | wc -l) | |
175 | 175 | if [ $nbres_p1 -gt 0 ] |
176 | 176 | then |
177 | 177 | pourcentage=$((($nbtreil_p2*100)/$nbres_p1)) |
... | ... | @@ -201,7 +201,7 @@ |
201 | 201 | #--------------------------------------------------# |
202 | 202 | # Speaker Adaptation (AM) + Second pass (DECODING) # |
203 | 203 | #--------------------------------------------------# |
204 | -print_info "Launch Second Pass" 2 | |
204 | +print_info "Launch Second Pass" 1 | |
205 | 205 | |
206 | 206 | # for all speaker |
207 | 207 | for speaker in $(cat $LBL_FILE_P1 | cut -f4 -d" " | sort | uniq) |
tools/scripts/Tools.sh
... | ... | @@ -29,13 +29,13 @@ |
29 | 29 | if [ $# -eq 3 ] |
30 | 30 | then |
31 | 31 | # print error |
32 | - if [ $1 -eq $ERROR ]; then echo -ne "###ERROR : $3\n" > 2; fi | |
32 | + if [ $1 -eq $ERROR ]; then echo -ne "###ERROR : $3\n" > /dev/stderr; exit 0; fi | |
33 | 33 | # check verbose level |
34 | 34 | if [ $2 -le $VERBOSE ] |
35 | 35 | then |
36 | 36 | for (( dec=1 ; $dec<$2 ; dec++ )); do echo -ne "\t"; done |
37 | 37 | # print warn |
38 | - if [ $1 = $WARN ]; then echo -ne "##WARNING : $3\n"; fi | |
38 | + if [ $1 = $WARN ]; then echo -ne "##WARNING : $3\n"; exit 0; fi | |
39 | 39 | # default info |
40 | 40 | echo -ne "#INFO : $3\n" |
41 | 41 | fi |
... | ... | @@ -72,6 +72,17 @@ |
72 | 72 | print_message $INFO $2 "$1" |
73 | 73 | else |
74 | 74 | print_message $INFO $VERBOSE "$1" |
75 | + fi | |
76 | +} | |
77 | + | |
78 | +# print_log_file(filename,message) | |
79 | +# - filename : full path to log file | |
80 | +# - message : message to log | |
81 | +print_log_file() | |
82 | +{ | |
83 | + if [ $# -eq 2 ] | |
84 | + then | |
85 | + echo -e "$message" >> $filename | |
75 | 86 | fi |
76 | 87 | } |