From 135404bcf3b764441731134b9822b01a6e4902f0 Mon Sep 17 00:00:00 2001 From: rey jean-Francois Date: Wed, 31 Jul 2013 16:19:07 +0200 Subject: [PATCH] Modify verbose and log system into FirstPass.sh --- main_tools/FirstPass.sh | 116 +++++++++++++++++++---------------- main_tools/OneScriptToRuleThemAll.sh | 68 ++++++++++++++++---- main_tools/SecondPass.sh | 6 +- tools/scripts/Tools.sh | 14 ++++- 4 files changed, 135 insertions(+), 69 deletions(-) diff --git a/main_tools/FirstPass.sh b/main_tools/FirstPass.sh index 113b11c..72ed169 100755 --- a/main_tools/FirstPass.sh +++ b/main_tools/FirstPass.sh @@ -33,7 +33,8 @@ if [ -e $FIRSTPASS_CONFIG_FILE ] then . $FIRSTPASS_CONFIG_FILE else - echo "ERROR : Can't find configuration file $FIRSTPASS_CONFIG_FILE" >&2 + echo "ERROR : Can't find configuration file $FIRSTPASS_CONFIG_FILE" > /dev/stderr + echo "exit" > /dev/stderr exit 1 fi @@ -49,7 +50,7 @@ do echo -e "\t\t-h :\tprint this message" echo -e "\t\t-D :\tDEBUG mode on" echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode" - echo -e "\t\t-c :\tCheck process, stop if error detected" + echo -e "\t\t-c :\tCheck process, and log it into files, can stop if error detected" echo -e "\t\t-f n :\tspecify a speeral forks number (default 1)" echo -e "\t\t-r :\tforce rerun the wav file" exit 1 @@ -112,8 +113,8 @@ then # wav filename without extension BASENAME=${FILENAME%.*} - print_info "=> $BASENAME P1 | $(date +'%d/%m/%y %H:%M:%S')" 1 - print_info "$WAV_FILE OK" 1 + print_info "[${BASENAME}] => P1 start | $(date +'%d/%m/%y %H:%M:%S')" 1 + print_info "[${BASENAME}] $WAV_FILE OK" 2 else print_error "can't find $1 OR file is empty" exit 1 @@ -123,7 +124,7 @@ fi if [ ! -e $2 ] then mkdir -p $2 - print_info "Make directory $2" 1 + print_info "[${BASENAME}] Make directory $2" 2 fi @@ -137,8 +138,8 @@ PLP_DIR="$OUTPUT_DIR_BASENAME/PLP/" # Segmented PLP files directory SEG_FILE="$OUTPUT_DIR_BASENAME/$BASENAME.seg" # Global Seg file LBL_FILE="$OUTPUT_DIR_BASENAME/$BASENAME.lbl" # Global LBL file RES_DIR=$OUTPUT_DIR_BASENAME"/res_p1" -LOGFILE="$OUTPUT_DIR/info_p1.log" -ERRORFILE="$OUTPUT_DIR/error_p1.log" +LOGFILE="$OUTPUT_DIR_BASENAME/info_p1.log" +ERRORFILE="$OUTPUT_DIR_BASENAME/error_p1.log" #------------------# # Create WORKSPACE # @@ -146,7 +147,7 @@ ERRORFILE="$OUTPUT_DIR/error_p1.log" if [ ! -e $OUTPUT_DIR_BASENAME ] then mkdir -p $OUTPUT_DIR_BASENAME - print_info "Make directory $OUTPUT_DIR_BASENAME" 1 + print_info "[${BASENAME}] Make directory $OUTPUT_DIR_BASENAME" 2 fi # Lock directory @@ -156,7 +157,7 @@ touch "$OUTPUT_DIR_BASENAME/FIRSTPASS.lock" > /dev/null 2>&1 rm -r $PLP_DIR > /dev/null 2>&1; mkdir -p $PLP_DIR -print_info "Make directory $PLP_DIR" 1 +print_info "[${BASENAME}] Make directory $PLP_DIR" 2 if [ $RERUN -eq 0 ]; then rm -r $RES_DIR > /dev/null 2>&1; @@ -164,7 +165,8 @@ else rm $RES_DIR/*.lock > /dev/null 2>&1 fi mkdir -p $RES_DIR > /dev/null 2>&1 -print_info "Make directory $RES_DIR" 1 +print_info "[${BASENAME}] Make directory $RES_DIR" 2 +rm $LOGFILE $ERRORFILE > /dev/null 2>&1 #--------------------# # Save configuration # @@ -180,7 +182,7 @@ echo "PLP_DIR=$PLP_DIR" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg echo "SEG_FILE=$SEG_FILE" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg echo "LBL_FILE=$LBL_FILE" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg echo "RES_DIR=$RES_DIR" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg -print_info "save config in $OUTPUT_DIR_BASENAME/FirstPass.cfg" 1 +print_info "[${BASENAME}] save config in $OUTPUT_DIR_BASENAME/FirstPass.cfg" 1 #-------------------------# # Check Audio File Format # @@ -195,12 +197,12 @@ if [ -z "$temp" ]; then error=1; fi if [ $error -eq 1 ] then - print_message $WARNING 2 "$WAV_FILE is not a wav file at 16000 Hz, 1 channel, 16bits\nhave to convert" - print_message $INFO 3 "avconv -i $WAV_FILE -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 $OUTPUT_DIR_BASENAME/$BASENAME.wav" + print_message $WARNING 2 "[${BASENAME}] $WAV_FILE is not a wav file at 16000 Hz, 1 channel, 16bits\nhave to convert" + 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" avconv -i $WAV_FILE -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 $OUTPUT_DIR_BASENAME/$BASENAME.wav $REDIRECTION_OUTPUT WAV_FILE=$OUTPUT_DIR_BASENAME/$BASENAME.wav FILENAME=$BASENAME.wav - print_message $INFO 1 "new wav file : $WAV_FILE" + print_message $INFO 1 "[${BASENAME}] new wav file : $WAV_FILE" fi #---------------# @@ -209,16 +211,15 @@ fi if [ -s $(dirname $WAV_FILE)/$BASENAME.SRT ] then cp $(dirname $WAV_FILE)/$BASENAME.SRT $OUTPUT_DIR_BASENAME/$BASENAME.SRT - print_info "copy $BASENAME.SRT file into workingspace" 1 + print_info "[${BASENAME}] copy $BASENAME.SRT file into $OUTPUT_DIR_BASENAME" 3 fi #------------# # WAV -> PLP # #------------# -print_info "convert WAV -> PLP" 1 +print_info "[${BASENAME}] convert WAV -> PLP" 1 echo $FILENAME > $OUTPUT_DIR_BASENAME/list.tmp -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 -" 2 +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 $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 @@ -227,7 +228,8 @@ then check_first_pass_plp "$PLP_FILE" if [ $? -eq 1 ] then - echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $PLP_FILE" >> $ERRORFILE + print_log_file "$ERROFILE" "ERROR [$(date +'%d/%m/%y %H:%M:%S')] Creating PLP file : $PLP_FILE" + echo "[${BASENAME}] ERROR : ${BASENAME} check $ERRORFILE file" > /dev/stderr exit 1 fi fi @@ -237,27 +239,29 @@ rm $OUTPUT_DIR_BASENAME/list.tmp #------------------------------# # S/NS + SPEAKERS SEGMENTATION # #------------------------------# -print_info "Launch speakers diarization" 1 +print_info "[${BASENAME}] Launch speakers diarization" 1 # Calcul seg file -print_info "java -Xmx4096m -jar $BIN_PATH/LIUM_SpkDiarization-4.2.jar --fInputMask=${WAV_FILE} --sOutputMask=${SEG_FILE} $BASENAME" 2 +print_info "[${BASENAME}] java -Xmx4096m -jar $BIN_PATH/LIUM_SpkDiarization-4.2.jar --fInputMask=${WAV_FILE} --sOutputMask=${SEG_FILE} $BASENAME" 3 #java -Xmx8000m -Xms2048 -jar $BIN_PATH/LIUM_SpkDiarization-4.2.jar --fInputMask=${WAV_FILE} --sOutputMask=${SEG_FILE} $BASENAME java -Xmx4096m -jar $BIN_PATH/LIUM_SpkDiarization-4.2.jar --fInputMask=${WAV_FILE} --sOutputMask=${SEG_FILE} $BASENAME $REDIRECTION_OUTPUT #–doCEClustering if [ $CHECK -eq 1 ] && ( [ ! -e $SEG_FILE ] || [ -z $SEG_FILE ] ) then - echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $SEG_FILE" >> $ERRORFILE + print_log_file "$ERRORFILE" "ERROR [$(date +'%d/%m/%y %H:%M:%S')] Creating SEG file : $SEG_FILE" + echo "[${BASENAME}] ERROR : check $ERRORFILE file" > /dev/stderr exit 1 fi # Create LBL file -print_info "Extract LBL file from SEG file" 2 +print_info "Extract LBL file from SEG file" 1 cat $SEG_FILE | grep -v ";;" | cut -f3,4,5,8 -d" " | tr " " "#" | sort -k1 -n | tr "#" " " > $LBL_FILE if [ $CHECK -eq 1 ] && ( [ ! -e $LBL_FILE ] || [ -z $LBL_FILE ] ) then - echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $LBL_FILE" >> $ERRORFILE + print_log_file "$ERRORFILE" "ERROR [$(date +'%d/%m/%y %H:%M:%S')] Creating LBL file : $LBL_FILE" + echo "[${BASENAME}] ERROR : check $ERRORFILE file" > /dev/stderr exit 1 fi @@ -265,8 +269,8 @@ fi #----------------------------------------------------# # Cut global PLP file depending to LBL segmentations # #----------------------------------------------------# -print_info "Cut PLP file depending to LBL segmentations" 1 -print_info "$BIN_PATH/gcep $PLP_FILE $LBL_FILE 500 $PLP_DIR -FSEG" 2 +print_info "[${BASENAME}] Cut PLP file depending to LBL segmentations" 1 +print_info "[${BASENAME}] $BIN_PATH/gcep $PLP_FILE $LBL_FILE 500 $PLP_DIR -FSEG" 3 $SPEERAL_TOOLS/gcep $PLP_FILE $LBL_FILE 500 $PLP_DIR -FSEG $REDIRECTION_OUTPUT @@ -275,7 +279,8 @@ then check_first_pass_plps_lbl $PLP_DIR $LBL_FILE if [ $? -eq 1 ] then - echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $PLP wrong .plp files number" >> $ERRORFILE + print_log_file $ERRORFILE "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $PLP wrong number of .plp files" + echo "[${BASENAME}] ERROR : check $ERRORFILE file" > /dev/stderr exit 1 fi fi @@ -289,7 +294,7 @@ cd $OLDPWD #---------------------------------------------# # PLP files list depending to acoustic models # #---------------------------------------------# -print_info "Create PLP list depending of the model" 1 +print_info "[${BASENAME}] Create PLP list depending of the model" 1 # Create a list of plp files find $PLP_DIR -type f -exec basename "{}" .plp \; | sort > $OUTPUT_DIR_BASENAME/plp.lst @@ -298,7 +303,7 @@ for (( i=0; $i<${#MTAG[@]} ; i++ )) do a=`grep -e "${MTAG[$i]}" $OUTPUT_DIR_BASENAME/plp.lst` if [ -n "$a" ]; then - print_info "$OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst" 3 + print_info "[${BASENAME}] Creating $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst" 3 grep -e "${MTAG[$i]}" $OUTPUT_DIR_BASENAME/plp.lst | sort > $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst fi done @@ -310,7 +315,7 @@ done # For all AM do decoding # if Check error -> iter on undone decoding (max 1 times) # -print_info "Launch decoding" 1 +print_info "[${BASENAME}] Launch decoding" 1 for (( i=0; $i<${#MTAG[@]} ; i++ )) do redo=1; # nb of try if not all segs is decoded @@ -319,7 +324,7 @@ do todo=$OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst while [ $redo -gt 0 ]; do rm $RES_DIR/*.lock > /dev/null 2>&1 - 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 + 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 # Run speeral $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 @@ -332,58 +337,63 @@ do then # rerun redo=$(($redo - 1)); - echo -e "WARN : Speeral output ERROR ${OUTPUT_DIR_BASENAME}/plp_${MODS[$i]}.lst" >> $ERRORFILE + print_warn "[${BASENAME}] Speeral output error : check $LOGFILE" 2 + print_log_file $LOGFILE "WARN : Speeral number of output ERROR ${OUTPUT_DIR_BASENAME}/plp_${MODS[$i]}.lst" # new plp list # list .seg done and compare to list of seg to do ls $RES_DIR/*.seg | grep -e "${MTAG[$i]}" | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp diff ${OUTPUT_DIR_BASENAME}/plp_${MODS[$i]}.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" > ${OUTPUT_DIR_BASENAME}/todo.lst rm ${OUTPUT_DIR_BASENAME}/.tmp # log seg to do - cat ${OUTPUT_DIR_BASENAME}/todo.lst >> $ERRORFILE + print_log_file $LOGFILE "Segs not done :" + cat ${OUTPUT_DIR_BASENAME}/todo.lst >> $LOGFILE todo=${OUTPUT_DIR_BASENAME}/todo.lst - echo -e "WARN : Try $redo" >> $ERRORFILE + print_warn "[${BASENAME}] Try $redo" 3 fi - else - redo=-5; fi done - if [ $redo -eq 0 ] - then - echo -e "ERROR : Speeral $todo" >> $ERRORFILE - cat ${OUTPUT_DIR_BASENAME}/todo.lst >> $ERRORFILE - #exit 1 - fi rm ${OUTPUT_DIR_BASENAME}/todo.lst > /dev/null 2>&1 #rm $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst rm $RES_DIR/*.lock > /dev/null 2>&1 fi done -print_info "<= End P1 $BASENAME | $(date +'%d/%m/%y %H:%M:%S')" 1 - ## Check missing seg and log it -ls $RES_DIR/*.seg | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp -echo -e "$BASENAME P1 END\n[" >> $LOGFILE -diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE -todo=$(cat ${OUTPUT_DIR_BASENAME}/plp.lst | wc -l) -notdone=$(($todo - $(cat ${OUTPUT_DIR_BASENAME}/.tmp | wc -l))) -pourcentage=$((($notdone*100)/$todo)) -echo -e "] $pourcentage% $BASENAME" >> $LOGFILE -rm ${OUTPUT_DIR_BASENAME}/.tmp +if [ $CHECK -eq 1 ] +then + ls $RES_DIR/*.seg | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp + todo=$(cat ${OUTPUT_DIR_BASENAME}/plp.lst | wc -l) + if [ $todo -eq 0 ]; then todo=1;fi + notdone=$(($todo - $(cat ${OUTPUT_DIR_BASENAME}/.tmp | wc -l))) + pourcentage=$((($notdone*100)/$todo)) + if [ $notdone -ne 0 ] + then + print_error "[${BASENAME}] ERROR : check $ERRORFILE" + print_log_file "$ERRORFILE" "ERROR : Segs not done [" + diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $ERROFILE + print_log_file "$ERRORFILE" "] $pourcentage% $BASENAME" + else + print_log_file "$LOGFILE" "P1 OK $BASENAME | $(date +'%d/%m/%y %H:%M:%S')" + fi + rm ${OUTPUT_DIR_BASENAME}/.tmp +fi #---------------# # Convert res # #---------------# - +print_info "[${BASENAME}] Convert .res into .ctm" 1 # .res => .ctm $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format CTM --ignore $RULES/asupp --out $OUTPUT_DIR_BASENAME/$BASENAME.1pass.ctm $REDIRECTION_OUTPUT +print_info "[${BASENAME}] Convert .res into .trs" 1 # .res => .trs echo -e "name $AUTHOR\nfileName $BASENAME\nfileExt wav\nsegFile $OUTPUT_DIR_BASENAME/$BASENAME.seg" > $OUTPUT_DIR_BASENAME/$BASENAME.trs_cfg $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 rm $OUTPUT_DIR_BASENAME/$BASENAME.trs_cfg 2> /dev/null +print_info "[${BASENAME}] Convert .res into .txt" 1 # .res => .txt $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TXT --ignore $RULES/asupp --out $OUTPUT_DIR_BASENAME/$BASENAME.1pass.txt $REDIRECTION_OUTPUT +print_info "[${BASENAME}] <= P1 End | $(date +'%d/%m/%y %H:%M:%S')" 1 # unlock directory mv "$OUTPUT_DIR_BASENAME/FIRSTPASS.lock" "$OUTPUT_DIR_BASENAME/FIRSTPASS.unlock" diff --git a/main_tools/OneScriptToRuleThemAll.sh b/main_tools/OneScriptToRuleThemAll.sh index edac1c0..8b07de0 100755 --- a/main_tools/OneScriptToRuleThemAll.sh +++ b/main_tools/OneScriptToRuleThemAll.sh @@ -43,11 +43,18 @@ fi MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0)) RING="" +$p1=0 +$p2=0 +$conf=0 +$exploitconf=0 +$p3=0 +$recompose=0 +$scoring=0 #---------------# # Parse Options # #---------------# -while getopts ":hDv:cf:r" opt +while getopts ":hDv:cf:r123CeRs" opt do case $opt in h) @@ -57,8 +64,16 @@ do echo -e "\t\t-D :\tDEBUG mode on" echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode" echo -e "\t\t-c :\tCheck process, stop if error detected" - echo -e "\t\t-f n :\tspecify a speeral forks number (default 1)" - echo -e "\t\t-r :\tforce rerun the wav file" + echo -e "\t\t-f n :\tSpecify a speeral forks number (default 1)" + echo -e "\t\t-r :\tForce to rerun without deleting all files" + echo -e "\t\t-a :\tDo every pass" + echo -e "\t\t-1 :\tDo 1rt pass" + echo -e "\t\t-2 :\tDo 2nd pass" + echo -e "\t\t-3 :\tDo 3rd pass" + echo -e "\t\t-C :\tDo confidence pass" + echo -e "\t\t-e :\tDo exploit confidence pass (SOLR)" + echo -e "\t\t-R :\tDo recompose res" + echo -e "\t\t-s :\tDo scoring" exit 1 ;; D) @@ -76,6 +91,36 @@ do r) RING=$RING" -r" ;; + a) + p1=1 + p2=1 + p3=1 + conf=1 + exploitconf=1 + recompose=1 + scoring=1 + ;; + 1) + p1=1 + ;; + 2) + p2=1 + ;; + 3) + p3=1 + ;; + C) + conf=1 + ;; + e) + exploitconf=1 + ;; + a) + recompose=1 + ;; + s) + scoring=1 + ;; :) echo "Option -$OPTARG requires an argument." >&2 exit 1 @@ -101,14 +146,15 @@ if [ -e $1 ] && [ -s $1 ] then echo -e "$LORD\n" REP_OUT=$2/${1%.*} - ${MAIN_SCRIPT_PATH}/FirstPass.sh ${RING} $1 $2 - ${MAIN_SCRIPT_PATH}/SecondPass.sh ${RING} ${REP_OUT} - ${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p2" - ${MAIN_SCRIPT_PATH}/ExploitConfidencePass.sh ${RING} ${REP_OUT} - ${MAIN_SCRIPT_PATH}/ThirdPass.sh ${RING} ${REP_OUT} - ${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p3" - ${MAIN_SCRIPT_PATH}/RecomposePass.sh ${RING} ${REP_OUT} - ${MAIN_SCRIPT_PATH}/ScoringRes.sh ${RING} ${REP_OUT} + if [ $p1 -eq 1 ];then ${MAIN_SCRIPT_PATH}/FirstPass.sh ${RING} $1 $2;fi + if [ $p2 -eq 1 ];then ${MAIN_SCRIPT_PATH}/SecondPass.sh ${RING} ${REP_OUT};fi + if [ $conf -eq 1 ];then $p${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p2";fi + if [ $exploitconf -eq 1 ]; then ${MAIN_SCRIPT_PATH}/ExploitConfidencePass.sh ${RING} ${REP_OUT};fi + if [ $p3 -eq 1 ];then ${MAIN_SCRIPT_PATH}/ThirdPass.sh ${RING} ${REP_OUT};fi + if [ $conf -eq 1 ];then ${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p3";fi + if [ $recompose -eq 1 ];then ${MAIN_SCRIPT_PATH}/RecomposePass.sh ${RING} ${REP_OUT};fi + if [ $scoring -eq 1 ];then ${MAIN_SCRIPT_PATH}/ScoringRes.sh ${RING} ${REP_OUT};fi + echo "done" else echo "can't find $1 OR file is empty" exit 1 diff --git a/main_tools/SecondPass.sh b/main_tools/SecondPass.sh index 4fad46d..3d5c137 100755 --- a/main_tools/SecondPass.sh +++ b/main_tools/SecondPass.sh @@ -170,8 +170,8 @@ do done # Check if more then 89% of treil are done -nbres_p1=$(ls $RES_DIR_P1/*.res | wc -l) -nbtreil_p2=$(ls $RES_DIR/*.treil | wc -l) +nbres_p1=$(ls $RES_DIR_P1/*.res 2> /dev/null | wc -l) +nbtreil_p2=$(ls $RES_DIR/*.treil 2> /dev/null | wc -l) if [ $nbres_p1 -gt 0 ] then pourcentage=$((($nbtreil_p2*100)/$nbres_p1)) @@ -201,7 +201,7 @@ print_info "save config in $OUTPUT_DIR_BASENAME/SecondPass.cfg" 1 #--------------------------------------------------# # Speaker Adaptation (AM) + Second pass (DECODING) # #--------------------------------------------------# -print_info "Launch Second Pass" 2 +print_info "Launch Second Pass" 1 # for all speaker for speaker in $(cat $LBL_FILE_P1 | cut -f4 -d" " | sort | uniq) diff --git a/tools/scripts/Tools.sh b/tools/scripts/Tools.sh index a2d2b10..a19f85c 100755 --- a/tools/scripts/Tools.sh +++ b/tools/scripts/Tools.sh @@ -29,13 +29,13 @@ function print_message() if [ $# -eq 3 ] then # print error - if [ $1 -eq $ERROR ]; then echo -ne "###ERROR : $3\n" > 2; fi + if [ $1 -eq $ERROR ]; then echo -ne "###ERROR : $3\n" > /dev/stderr; exit 0; fi # check verbose level if [ $2 -le $VERBOSE ] then for (( dec=1 ; $dec<$2 ; dec++ )); do echo -ne "\t"; done # print warn - if [ $1 = $WARN ]; then echo -ne "##WARNING : $3\n"; fi + if [ $1 = $WARN ]; then echo -ne "##WARNING : $3\n"; exit 0; fi # default info echo -ne "#INFO : $3\n" fi @@ -75,3 +75,13 @@ function print_info() fi } +# print_log_file(filename,message) +# - filename : full path to log file +# - message : message to log +print_log_file() +{ + if [ $# -eq 2 ] + then + echo -e "$message" >> $filename + fi +} -- 1.8.2.3