From 9456401f804acd7976a25465be9d72b733fc4e88 Mon Sep 17 00:00:00 2001 From: rey jean-Francois Date: Wed, 31 Jul 2013 18:15:33 +0200 Subject: [PATCH] modify info and log file system in SecondPass and ConPass --- main_tools/ConfPass.sh | 75 +++++++++++++++++++++++---------- main_tools/FirstPass.sh | 14 +++---- main_tools/SecondPass.sh | 94 ++++++++++++++++++++++++++++-------------- tools/scripts/CheckConfPass.sh | 15 +++++-- 4 files changed, 134 insertions(+), 64 deletions(-) diff --git a/main_tools/ConfPass.sh b/main_tools/ConfPass.sh index 5a41468..c83cad8 100755 --- a/main_tools/ConfPass.sh +++ b/main_tools/ConfPass.sh @@ -34,7 +34,7 @@ if [ -e $CONFPASS_CONFIG_FILE ] then . $CONFPASS_CONFIG_FILE else - echo "ERROR : Can't find configuration file $CONFPASS_CONFIG_FILE" >&2 + echo "ERROR : Can't find configuration file $CONFPASS_CONFIG_FILE" > /dev/stderr exit 1 fi @@ -67,7 +67,7 @@ do RERUN=1 ;; :) - echo "Option -$OPTARG requires an argument." >&2 + echo "Option -$OPTARG requires an argument." > /dev/stderr exit 1 ;; \?) @@ -123,9 +123,8 @@ RES_P="${INPUT_DIR}/${RES_NAME}" USF_FILE=${INPUT_DIR}/${BASENAME}.${RES_NAME}.usf CONF_DIR="$OUTPUT_DIR/conf/$RES_NAME" RES_CONF_DIR="$OUTPUT_DIR/conf/$RES_NAME/scored_ctm" -LOGFILE="$(dirname $OUTPUT_DIR)/info_conf.log" -ERRORFILE="$(dirname $OUTPUT_DIR)/error_conf.log" - +LOGFILE="${OUTPUT_DIR_BASENAME}/info_conf.log" +ERRORFILE="${OUTPUT_DIR_BASENAME}/error_conf.log" #------------------# # Create Workspace # @@ -133,7 +132,7 @@ ERRORFILE="$(dirname $OUTPUT_DIR)/error_conf.log" # Lock directory if [ -e "$OUTPUT_DIR/CONFPASS.lock" ] && [ $RERUN -eq 0 ] then - print_info "Confpass lock $INPUT_DIR -> exit" 1 + print_warn "[${BASENAME}] Confpass is locked -> exit" 2 exit 1 fi rm "$OUTPUT_DIR/CONFPASS.unlock" > /dev/null 2>&1 @@ -142,29 +141,56 @@ if [ $RERUN -eq 0 ]; then rm -r $CONF_DIR > /dev/null 2>&1; fi if [ $RERUN -eq 1 ]; then rm $USF_FILE > /dev/null 2>&1; fi mkdir -p $CONF_DIR > /dev/null 2>&1 mkdir -p $RES_CONF_DIR > /dev/null 2>&1 +rm $LOGFILE $ERRORFILE > /dev/null 2>&1 #---------------# # Check Pass # #---------------# - -# if usf contains more than 40% of 0.600 confidence -> usf error +print_info "[${BASENAME}] Check Conf Pass directory ${RES_NAME}" 1 +# if usf contains more than 49% of 0.600 confidence -> usf error if [ -s $USF_FILE ] then conftozerosix=$(grep -c -E 'confidence="0.600"' "${USF_FILE}") - conftoother=$(grep -c -v -E 'confidence="0.600"' "${USF_FILE}") - if [ $conftoother -gt 0 ] + confall=$(grep -c -E 'confidence=' "${USF_FILE}") + if [ $confall -gt 0 ] then - pourcentageofzerosix=$((($conftozerosix*100)/$conftoother)) - if [ $pourcentageofzerosix -gt 40 ] + pourcentageofzerosix=$((($conftozerosix*100)/$confall)) + if [ $pourcentageofzerosix -gt 49 ] then - print_warn "${USF_FILE} got $pourcentageofzerosix% of 0.6 confidence" 1 + print_warn "[${BASENAME}] ${BASENAME}.${RES_NAME}.usf got $pourcentageofzerosix% of 0.600 confidence" 2 + print_info "[${BASENAME}] bad usf ${RES_NAME}, will do it again" 1 mv "${USF_FILE}" "${USF_FILE}.back" rm -r $CONF_DIR > /dev/null 2>&1 else - print_warn "${USF_FILE} already done, skipping it" 1 + print_warn "[${BASENAME}] ${USF_FILE} already done, skipping it" 1 exit 0 fi fi +else + print_info "[${BASENAME}] No USF file already done, continue..." 1 +fi + +# Check if treil are here +nbres_p1=$(cat ${INPUT_DIR}/plp.lst | wc -l) +nbtreil_p=$(ls $RES_P/*.treil 2> /dev/null | wc -l) +if [ $nbtreil_p -eq 0 ] +then + print_error "[${BASENAME}] No ${RES_NAME} Pass, No .treil -> exit ConfPass" + if [ $CHECK -eq 1 ]; then print_log_file $ERRORFILE "No ${RES_NAME} Pass, No .treil -> exit ConfPass" ;fi + exit 1 +else + #Check if more then 89% of treil are done + if [ $nbres_p1 -gt 0 ] + then + pourcentage=$((($nbtreil_p*100)/$nbres_p1)) + if [ $pourcentage -gt 89 ] + then + print_info "[${BASENAME}] ${RES_NAME}/*.treil are here" 1 + else + print_warn "[${BASENAME}] not enough ${RES_NAME} treil" 2 + if [ $CHECK -eq 1 ]; then print_log_file $ERRORFILE "Not enough ${RES_NAME} treil " + fi + fi fi #------# @@ -173,12 +199,13 @@ fi cp $CONFPASS_CONFIG_FILE $OUTPUT_DIR/ConfPass.cfg echo "RES_CONF_DIR=$RES_CONF_DIR" >> $OUTPUT_DIR/ConfPass.cfg echo "CONF_DIR=$CONF_DIR" >> $OUTPUT_DIR/ConfPass.cfg +print_info "[${BASENAME}] Save config in $OUTPUT_DIR_BASENAME/ConfPass.cfg" 1 #--------------------# # CONFIDENCE MEASURE # #--------------------# -# Check pourcentage of scored_ctm already done, if < 85% done confidence measure +# Check pourcentage of scored_ctm already done, if < 85% do confidence measure nbres_p=$(ls ${RES_P}/*.treil | wc -l) nbconf=$(ls ${RES_CONF_DIR}/*.res | wc -l) if [ $nbres_p -gt 0 ] @@ -186,11 +213,11 @@ then pourcentageres=$((($nbconf*100)/$nbres_p)) if [ $pourcentageres -lt 85 ] then - print_info "Calcul Confidence $INPUT_DIR $RES_NAME" 1 + print_info "[${BASENAME}] Calcul Confidence $INPUT_DIR $RES_NAME" 1 $MAIN_SCRIPT_PATH/ConfidenceMeasure.sh $INPUT_DIR $RES_NAME $REDIRECTION_OUTPUT else - print_info "skipping Confidence Calcul $INPUT_DIR/$RES_NAME" 1 + print_info "[${BASENAME}] Skipping Confidence Calcul $INPUT_DIR/$RES_NAME" 1 fi fi @@ -198,16 +225,22 @@ fi if [ $CHECK -eq 1 ] then nbconf=$(ls ${RES_CONF_DIR}/*.res | wc -l) - if [ $nbres_p -ne $nbconf ];then echo "WARN : ConfPass $INPUT_DIR/$RES_NAME number of res files differ" >> $LOGFILE;fi + if [ $nbres_p -ne $nbconf ] + then + print_warn "WARN : ConfPass $INPUT_DIR/$RES_NAME number of res files differ" 2 + print_log_file $LOGFILE "WARN : ConfPass $INPUT_DIR/$RES_NAME number of res files differ" + fi fi #---------------------------# # FROM RES WITH CONF => USF # #---------------------------# +print_info "[${BASENAME}] Create USF file for $RES_P" 1 for f in `ls ${RES_CONF_DIR}`; do $SCRIPT_PATH/formatRES.pl $RES_CONF_DIR/$f; done # create USF configuration file echo -e "name $AUTHOR\nfileName $BASENAME\nfileExt wav\nsegFile $OUTPUT_DIR/$BASENAME.seg" > $OUTPUT_DIR/$BASENAME.usf_cfg # create USF file +print_info "$SCRIPT_PATH/res2out.pl --dir $RES_CONF_DIR --format USF --ignore $RULES/asupp --out $USF_FILE.tmp --usf_config $OUTPUT_DIR/$BASENAME.usf_cfg $REDIRECTION_OUTPUT" 3 $SCRIPT_PATH/res2out.pl --dir $RES_CONF_DIR --format USF --ignore $RULES/asupp --out $USF_FILE.tmp --usf_config $OUTPUT_DIR/$BASENAME.usf_cfg $REDIRECTION_OUTPUT rm $OUTPUT_DIR/$BASENAME.usf_cfg > /dev/null 2>&1 cat $USF_FILE.tmp | $SCRIPT_PATH/BdlexUC.pl $RULES/basic -f > $USF_FILE @@ -222,7 +255,8 @@ then check_conf_pass_usf "$OUTPUT_DIR/$BASENAME.usf" if [ $? -eq 1 ] then - echo -e "ERROR : Wrong confidence measures in USF file : $OUTPUT_DIR/$BASENAME.usf" >> $ERRORFILE + print_error "[${BASENAME}] Wrong confidence measures in USF file : $OUTPUT_DIR/$BASENAME.usf" + print_log_file $ERRORFILE "ERROR : Wrong confidence measures in USF file : $OUTPUT_DIR/$BASENAME.usf" exit 1 fi fi @@ -231,8 +265,7 @@ fi # CLOSE # #-------# # Seem OK -print_info "<= End $BASENAME ConfPass | $(date +'%d/%m/%y %H:%M:%S')" 1 -echo -e "ConfPass $BASENAME OK" >> $LOGFILE +print_info "[${BASENAME}] <= ConfPass End | $(date +'%d/%m/%y %H:%M:%S')" 1 # unlock directory mv "$OUTPUT_DIR/CONFPASS.lock" "$OUTPUT_DIR/CONFPASS.unlock" diff --git a/main_tools/FirstPass.sh b/main_tools/FirstPass.sh index 72ed169..65dcaec 100755 --- a/main_tools/FirstPass.sh +++ b/main_tools/FirstPass.sh @@ -71,11 +71,11 @@ do RERUN=1 ;; :) - echo "Option -$OPTARG requires an argument." >&2 + echo "Option -$OPTARG requires an argument." > /dev/stderr exit 1 ;; \?) - echo "BAD USAGE : unknow opton -$OPTARG" + echo "BAD USAGE : unknow opton -$OPTARG" exit 1 ;; esac @@ -182,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 "[${BASENAME}] 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 # @@ -248,7 +248,7 @@ java -Xmx4096m -jar $BIN_PATH/LIUM_SpkDiarization-4.2.jar --fInputMask=${WAV_FIL if [ $CHECK -eq 1 ] && ( [ ! -e $SEG_FILE ] || [ -z $SEG_FILE ] ) then 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 + print_error "[${BASENAME}] ERROR : check $ERRORFILE file" exit 1 fi @@ -261,7 +261,7 @@ cat $SEG_FILE | grep -v ";;" | cut -f3,4,5,8 -d" " | tr " " "#" | sort -k1 -n | if [ $CHECK -eq 1 ] && ( [ ! -e $LBL_FILE ] || [ -z $LBL_FILE ] ) then 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 + print_error "[${BASENAME}] ERROR : check $ERRORFILE file" exit 1 fi @@ -280,7 +280,7 @@ then if [ $? -eq 1 ] then 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 + print_error "[${BASENAME}] ERROR : check $ERRORFILE file" exit 1 fi fi @@ -371,7 +371,7 @@ then 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 + diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $ERRORFILE print_log_file "$ERRORFILE" "] $pourcentage% $BASENAME" else print_log_file "$LOGFILE" "P1 OK $BASENAME | $(date +'%d/%m/%y %H:%M:%S')" diff --git a/main_tools/SecondPass.sh b/main_tools/SecondPass.sh index 3d5c137..980ad86 100755 --- a/main_tools/SecondPass.sh +++ b/main_tools/SecondPass.sh @@ -33,7 +33,8 @@ if [ -e $SECONDPASS_CONFIG_FILE ] then . $SECONDPASS_CONFIG_FILE else - echo "ERROR : Can't find configuration file $SECONDPASS_CONFIG_FILE" >&2 + echo "ERROR : Can't find configuration file $SECONDPASS_CONFIG_FILE" > /dev/stderr + echo "exit" > /dev/stderr exit 1 fi @@ -70,11 +71,11 @@ do RERUN=1 ;; :) - echo "Option -$OPTARG requires an argument." >&2 + echo "Option -$OPTARG requires an argument." > /dev/stderr exit 1 ;; \?) - echo "BAD USAGE : unknow opton -$OPTARG" + echo "BAD USAGE : unknow opton -$OPTARG" > /dev/stderr exit 1 ;; esac @@ -111,6 +112,8 @@ else exit 1 fi +print_info "[${BASENAME}] => P2 start | $(date +'%d/%m/%y %H:%M:%S')" 1 + #-------------# # GLOBAL VARS # #-------------# @@ -128,44 +131,46 @@ then RES_DIR_P1=$(cat $FIRSTPASS_CONFIG_FILE | grep "RES_DIR=" | cut -f2 -d"=") else print_error "can't find $FIRSTPASS_CONFIG_FILE file" + print_error "exit" exit 1 fi LST=$OUTPUT_DIR_BASENAME"/lists" HMM=$OUTPUT_DIR_BASENAME"/hmm/" RES_DIR=$OUTPUT_DIR_BASENAME"/res_p2" -LOGFILE="$OUTPUT_DIR/info_p2.log" -ERRORFILE="$OUTPUT_DIR/error_p2.log" +LOGFILE="$OUTPUT_DIR_BASENAME/info_p2.log" +ERRORFILE="$OUTPUT_DIR_BASENAME/error_p2.log" #------------------# # Create WORKSPACE # #------------------# # Lock directory -if [ -e $OUTPUT_DIR_BASENAME/SECONDPASS.lock ] && [ $RERUN -eq 0 ]; then exit 1;fi +if [ -e $OUTPUT_DIR_BASENAME/SECONDPASS.lock ] && [ $RERUN -eq 0 ]; then print_warn "[${BASENAME}] SECONDPASS is locked -> exit" 2; exit 1;fi rm "$OUTPUT_DIR_BASENAME/SECONDPASS.unlock" > /dev/null 2>&1 touch "$OUTPUT_DIR_BASENAME/SECONDPASS.lock" > /dev/null 2>&1 rm -r $LST > /dev/null 2>&1 mkdir -p $LST -print_info "Make directory $LST" 1 +print_info "[${BASENAME}] Make directory $LST" 2 if [ $RERUN -eq 0 ]; then rm -r $HMM > /dev/null 2>&1; fi mkdir -p $HMM -print_info "Make directory $HMM" 1 +print_info "[${BASENAME}] Make directory $HMM" 2 if [ $RERUN -eq 0 ]; then rm -r $RES_DIR > /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 #-------------------# # Check Pass # #-------------------# -print_info "Check Pass 2 directory" 1 +print_info "[${BASENAME}] Check Pass 2 directory" 1 for treil in $(ls $RES_DIR/ | grep treil) do if [ ! -s $RES_DIR/$treil ] then bn = $(basename $treil ".treil") rm $RES_DIR/$treil $RES_DIR/$bn.seg $RES_DIR/$bn.res $RES_DIR/$bn.pho 2> /dev/null - print_info "$RES_DIR/$bn.* files deleted.." 2 + print_info "[${BASENAME}] $RES_DIR/$bn.* files deleted.." 2 fi done @@ -177,9 +182,13 @@ then pourcentage=$((($nbtreil_p2*100)/$nbres_p1)) if [ $pourcentage -gt 89 ] then - echo "Lattice already done, skipping $BASENAME" + print_info "[${BASENAME}] Lattice already done, skipping $BASENAME" 1 exit 0 fi +else + print_error "[${BASENAME}] No First Pass, No .res -> exit P2" + if [ $CHECK -eq 1 ]; then print_log_file $ERRORFILE "No First Pass, No .res -> exit P2" ;fi + exit 1 fi #--------------------# @@ -195,20 +204,20 @@ echo "OUTPUT_DIR_BASENAME=$OUTPUT_DIR_BASENAME" >> $OUTPUT_DIR_BASENAME/SecondPa echo "LST=$LST" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg echo "HMM=$HMM" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg echo "RES_DIR=$RES_DIR" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg -print_info "save config in $OUTPUT_DIR_BASENAME/SecondPass.cfg" 1 +print_info "[${BASENAME}] Save config in $OUTPUT_DIR_BASENAME/SecondPass.cfg" 1 #--------------------------------------------------# # Speaker Adaptation (AM) + Second pass (DECODING) # #--------------------------------------------------# -print_info "Launch Second Pass" 1 +print_info "[${BASENAME}] Launch Second Pass" 1 # for all speaker for speaker in $(cat $LBL_FILE_P1 | cut -f4 -d" " | sort | uniq) do ## get seg file from P1 containing the speaker find $RES_DIR_P1 -name "*${speaker}.seg" -exec basename "{}" .seg \; | sort > $LST/$speaker.lst - print_info "file for $speaker in $LST/$speaker.lst" 3 + print_info "[${BASENAME}] file for $speaker in $LST/$speaker.lst" 3 if [ ! -s $LST/$speaker.lst ]; then print_warn "no ${speaker} file in $RES_DIR_P1" 3; continue; fi @@ -223,13 +232,15 @@ do ## HMM adaptation if [ $RERUN -eq 0 ] || ( [ ! -e $HMM/$speaker.hmm ] || [ -z $HMM/$speaker.hmm ] ) then - print_info "$SPEERAL_TOOLS/mllrmap $SPEERAL_AM/${MODS[$i]}.hmm -LR -b$LST/$speaker.lst -d$PLP_DIR_P1/ -t.plp -i3 -c.seg -o$HMM/$speaker.hmm -a$RES_DIR_P1/" 3 + print_info "[${BASENAME}] $SPEERAL_TOOLS/mllrmap $SPEERAL_AM/${MODS[$i]}.hmm -LR -b$LST/$speaker.lst -d$PLP_DIR_P1/ -t.plp -i3 -c.seg -o$HMM/$speaker.hmm -a$RES_DIR_P1/" 3 $SPEERAL_TOOLS/mllrmap $SPEERAL_AM/${MODS[$i]}.hmm -LR -b$LST/$speaker.lst -d$PLP_DIR_P1/ -t.plp -i3 -c.seg -o$HMM/$speaker.hmm -a$RES_DIR_P1/ $REDIRECTION_OUTPUT fi if [ $CHECK -eq 1 ] && ( [ ! -e $HMM/$speaker.hmm ] || [ -z $HMM/$speaker.hmm ] ) then - echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $HMM/$speaker.hmm" >> $ERRORFILE + print_warn "[${BASENAME}] No hmm files created for $speaker" 2 + print_log_file $ERRORFILE "ERROR [$(date +'%d/%m/%y %H:%M:%S')] No hmm files created for $speaker" + print_error "[${BASENAME}] Check $ERRORFILE" #exit 1 fi @@ -239,22 +250,25 @@ do ## class clustering if [ -s $HMM/$speaker.hmm ] && ( [ $RERUN -eq 0 ] || ( [ ! -e $HMM/$speaker.cls ] || [ -z $HMM/$speaker.cls ] )) then - print_info "$SPEERAL_TOOLS/gclust_pdf $HMM/$speaker.hmm $HMM/$speaker.cls -i $SPEERAL_AM/${MODS[$i]}.cls" 3 + print_info "[${BASENAME}] $SPEERAL_TOOLS/gclust_pdf $HMM/$speaker.hmm $HMM/$speaker.cls -i $SPEERAL_AM/${MODS[$i]}.cls" 3 $SPEERAL_TOOLS/gclust_pdf $HMM/$speaker.hmm $HMM/$speaker.cls -i $SPEERAL_AM/${MODS[$i]}.cls $REDIRECTION_OUTPUT fi if [ $CHECK -eq 1 ] && ( [ ! -e $HMM/$speaker.cls ] || [ -z $HMM/$speaker.cls ] ) then - echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $HMM/$speaker.cls" >> $ERRORFILE + print_warn "[${BASENAME}] No cls file created for $speaker" 2 + print_log_file $ERRORFILE "ERROR [$(date +'%d/%m/%y %H:%M:%S')] No cls file created for $speakers" + print_error "[${BASENAME}] Check $ERRORFILE" #exit 1 fi ## Speeral decoding if [ -s $HMM/$speaker.hmm ] && [ -s $HMM/$speaker.cls ] then - print_info "$SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_CFG[$i]} -r $PLP_DIR_P1 -m $HMM/$speaker.hmm -c $HMM/$speaker.cls $FORKS --lock $REDIRECTION_OUTPUT" 3 + print_info "[${BASENAME}] $SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_CFG[$i]} -r $PLP_DIR_P1 -m $HMM/$speaker.hmm -c $HMM/$speaker.cls $FORKS --lock $REDIRECTION_OUTPUT" 3 $SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_CFG[$i]} -r $PLP_DIR_P1 -m $HMM/$speaker.hmm -c $HMM/$speaker.cls $FORKS --lock $REDIRECTION_OUTPUT else - print_warn "$HMM/$speaker.hmm and $speaker.cls empty, do default decoding..." 2 + print_warn "[${BASENAME}] $HMM/$speaker.hmm and $speaker.cls empty, do default decoding..." 2 + print_info "[${BASENAME}] $SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_CFG[$i]} -r $PLP_DIR_P1 -m $SPEERAL_AM/${MODS[$i]}.hmm -c $SPEERAL_AM/${MODS[$i]}.cls $FORKS --lock $REDIRECTION_OUTPUT" 3 $SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_CFG[$i]} -r $PLP_DIR_P1 -m $SPEERAL_AM/${MODS[$i]}.hmm -c $SPEERAL_AM/${MODS[$i]}.cls $FORKS --lock $REDIRECTION_OUTPUT fi @@ -263,10 +277,12 @@ do check_second_pass_output_speeral "$LST/$speaker.lst" "$RES_DIR" if [ $? -eq 1 ] then - echo -e "ERROR : Speeral $LST/$speaker.lst\n[" >> $ERRORFILE + print_warn "[${BASENAME}] Speeral output error : check $LOGFILE" 2 + print_log_file $LOGFILE "WARN : Speeral number of output ERROR $LST/$speaker.lst" ls $RES_DIR/*.seg | grep -e "$speaker" | sed -e "s|$RES_DIR\/||" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp - diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp >> $ERRORFILE - echo -e "] " >> $ERRORFILE + print_log_file $LOGFILE "Segs (and treil) not done :\n[" + diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp >> $LOGFILE + print_log_file $LOGFILE "] [$(date +'%d/%m/%y %H:%M:%S')]" rm ${OUTPUT_DIR_BASENAME}/.tmp #exit 1 fi @@ -279,29 +295,43 @@ do #rm "$LST/$speaker.lst" > /dev/null 2>&1 done -print_info "<= End $BASENAME P2 | $(date +'%d/%m/%y %H:%M:%S')" 1 - ## Check missing seg and log it -ls $RES_DIR/*.treil | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.treil//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp -echo -e "$BASENAME P2 END\n[" >> $LOGFILE -diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE -echo -e "] $BASENAME" >> $LOGFILE -rm ${OUTPUT_DIR_BASENAME}/.tmp > /dev/null 2>&1 +if [ $CHECK -eq 1 ] +then + ls $RES_DIR/*.treil | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.treil//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp + todo=$(cat ${PLP_FILE_P1} | 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 : Treil not done [" + diff ${PLP_FILE_P1} ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $ERRORFILE + 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 > /dev/null 2>&1 +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}.2pass.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}.2pass.trs --trs_config ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg $REDIRECTION_OUTPUT rm ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg > /dev/null 2>&1 +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}.2pass.txt $REDIRECTION_OUTPUT - +print_info "[${BASENAME}] <= P2 End | $(date +'%d/%m/%y %H:%M:%S')" 1 # unlock directory mv "$OUTPUT_DIR_BASENAME/SECONDPASS.lock" "$OUTPUT_DIR_BASENAME/SECONDPASS.unlock" diff --git a/tools/scripts/CheckConfPass.sh b/tools/scripts/CheckConfPass.sh index e7c9430..e961ba7 100644 --- a/tools/scripts/CheckConfPass.sh +++ b/tools/scripts/CheckConfPass.sh @@ -20,16 +20,23 @@ function check_conf_pass_usf() then if [ -e "$1" ] && [ -s "$1" ] then - temp=`grep -c -E 'confidence="0.600"' "$1"` - if [ $temp -gt 200 ] + conftozerosix=$(grep -c -E 'confidence="0.600"' "$1") + confall=$(grep -c -E 'confidence=' "$1") + if [ $confall -gt 0 ] then - return 1 + pourcentageofzerosix=$((($conftozerosix*100)/$confall)) + if [ $pourcentageofzerosix -gt 49 ] + then + return 1 + + else + return 0 + fi fi else return 1 fi fi - return 0 } -- 1.8.2.3