Commit 1fd315c89e313c446c6f6ecf3a4ea98ac859ac88

Authored by Jean-François Rey
1 parent 0bf609bcce
Exists in master

add Extract audio and check results scripts

Showing 8 changed files with 247 additions and 43 deletions Side-by-side Diff

main_tools/CheckResults.sh
  1 +#!/bin/bash
  2 +
  3 +#################################
  4 +# File : CheckResults.sh #
  5 +# Brief : Check the results #
  6 +# Autohr : Jean-François Rey #
  7 +# Date : 30/07/2013 #
  8 +# Version : 1.0 #
  9 +#################################
  10 +
  11 +
  12 +# CheckDir( dir )
  13 +# dir : a directory path
  14 +# Brief : Check $dir results
  15 +function CheckDir()
  16 +{
  17 + if [ $# -eq 1 ]
  18 + then
  19 + plp=$(ls $1/PLP/*.plp 2> /dev/null | wc -l)
  20 + res_p1=$(ls $1/res_p1/*.res 2> /dev/null | wc -l)
  21 + res_p2=$(ls $1/res_p2/*.treil 2> /dev/null | wc -l)
  22 + res_p3=$(ls $1/res_p3/*.treil 2> /dev/null | wc -l)
  23 + usf_p2=$1/$(basename $1).res_p2.usf
  24 + usf_p3=$1/$(basename $1).res_p3.usf
  25 +
  26 + if [ -e $usf_p2 ]
  27 + then
  28 + casix=`grep -c -E 'confidence="0.600"' ${usf_p2}`
  29 + call=`grep -c -E 'confidence=' ${usf_p2}`
  30 + if [ $call -eq 0 ]
  31 + then
  32 + pourcentage_p2=100
  33 + else
  34 + pourcentage_p2=$((($casix*100)/$call))
  35 + fi
  36 + if [ $pourcentage_p2 -gt 49 ]
  37 + then
  38 + usf2="ERR"
  39 + else
  40 + usf2="OK"
  41 + fi
  42 + else
  43 + usf2="NAN"
  44 + fi
  45 + if [ -e $usf_p3 ]
  46 + then
  47 + casix=`grep -c -E 'confidence="0.600"' ${usf_p3}`
  48 + call=`grep -c -E 'confidence=' ${usf_p3}`
  49 + if [ $call -eq 0 ]
  50 + then
  51 + pourcentage_p3=100
  52 + else
  53 + pourcentage_p3=$((($casix*100)/$call))
  54 + fi
  55 + if [ $pourcentage_p3 -gt 49 ]
  56 + then
  57 + usf3="ERR"
  58 + else
  59 + usf3="OK"
  60 + fi
  61 + else
  62 + usf3="NAN"
  63 + fi
  64 + fi
  65 + echo -e "$(basename $1)\t$plp\t$res_p1\t$res_p2\t\t$res_p3\t\t$usf2\t$usf3"
  66 +
  67 +}
  68 +
  69 +
  70 +# Check OTMEDIA_HOME env var
  71 +if [ -z ${OTMEDIA_HOME} ]
  72 +then
  73 + OTMEDIA_HOME=$(dirname $(dirname $(readlink -e $0)))
  74 + export OTMEDIA_HOME=$OTMEDIA_HOME
  75 +fi
  76 +
  77 +# where is CheckResults.sh
  78 +MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0))
  79 +
  80 +
  81 +RECURSIVE=0
  82 +
  83 +#---------------#
  84 +# Parse Options #
  85 +#---------------#
  86 +while getopts ":hr" opt
  87 +do
  88 + case $opt in
  89 + h)
  90 + echo -e "$0 [OPTIONS] <DIRECTORY>\n"
  91 + echo -e "\t Options:"
  92 + echo -e "\t\t-h :\tprint this message"
  93 + echo -e "\t\t-r :\trecursive mode"
  94 + exit 1
  95 + ;;
  96 + r)
  97 + RECURSIVE=1
  98 + ;;
  99 + :)
  100 + echo "Option -$OPTARG requires an argument." >&2
  101 + exit 1
  102 + ;;
  103 + \?)
  104 + echo "BAD USAGE : unknow opton -$OPTARG"
  105 + exit 1
  106 + ;;
  107 + esac
  108 +done
  109 +
  110 +# Check USAGE by arguments number
  111 +if [ $(($#-($OPTIND-1))) -ne 1 ]
  112 +then
  113 + echo "BAD USAGE : FirstPass.sh [OPTIONS] <DIRECTORY>"
  114 + echo "$0 -h for more info"
  115 + exit 1
  116 +fi
  117 +
  118 +shift $((OPTIND-1))
  119 +# check Directory - First argument
  120 +if [ -e $1 ] && [ -s $1 ]
  121 +then
  122 + DIR=$(readlink -e $1)
  123 +else
  124 + echo "ERROR : can't open directory $1"
  125 + exit 1
  126 +fi
  127 +
  128 +
  129 +# Check directory results
  130 +echo -e "Directory name\t\t#plp\t#res_p1\t#treil_p2\t#treil_p3\tusf_p2\tusf_p3"
  131 +if [ $RECURSIVE -eq 0 ]
  132 +then
  133 + CheckDir "$DIR"
  134 +else
  135 + for d in `ls $DIR`
  136 + do
  137 + if [ -d "$DIR/$d" ]; then CheckDir "$DIR/$d"; fi
  138 + done
  139 +fi
main_tools/ConfPass.sh
... ... @@ -82,10 +82,13 @@
82 82 then
83 83 set -x
84 84 echo -e "## Mode DEBUG ON ##"
  85 + REDIRECTION_OUTPUT=""
  86 + else
  87 + REDIRECTION_OUTPUT=" 2> /dev/null"
85 88 fi
86 89  
87 90 # mode verbose enable
88   -if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ; fi
  91 +if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ;fi
89 92  
90 93 # Check USAGE by arguments number
91 94 if [ $(($#-($OPTIND-1))) -ne 2 ]
... ... @@ -137,8 +140,8 @@
137 140 touch "$OUTPUT_DIR/CONFPASS.lock" > /dev/null 2>&1
138 141 if [ $RERUN -eq 0 ]; then rm -r $CONF_DIR > /dev/null 2>&1; fi
139 142 if [ $RERUN -eq 1 ]; then rm $USF_FILE > /dev/null 2>&1; fi
140   -mkdir -p $CONF_DIR
141   -mkdir -p $RES_CONF_DIR
  143 +mkdir -p $CONF_DIR > /dev/null 2>&1
  144 +mkdir -p $RES_CONF_DIR > /dev/null 2>&1
142 145  
143 146 #---------------#
144 147 # Check Pass #
... ... @@ -184,7 +187,8 @@
184 187 if [ $pourcentageres -lt 85 ]
185 188 then
186 189 print_info "Calcul Confidence $INPUT_DIR $RES_NAME" 1
187   - $MAIN_SCRIPT_PATH/ConfidenceMeasure.sh $INPUT_DIR $RES_NAME
  190 + $MAIN_SCRIPT_PATH/ConfidenceMeasure.sh $INPUT_DIR $RES_NAME $REDIRECTION_OUTPUT
  191 +
188 192 else
189 193 print_info "skipping Confidence Calcul $INPUT_DIR/$RES_NAME" 1
190 194 fi
191 195  
... ... @@ -204,11 +208,11 @@
204 208 # create USF configuration file
205 209 echo -e "name $AUTHOR\nfileName $BASENAME\nfileExt wav\nsegFile $OUTPUT_DIR/$BASENAME.seg" > $OUTPUT_DIR/$BASENAME.usf_cfg
206 210 # create USF file
207   -$SCRIPT_PATH/res2out.pl --dir $RES_CONF_DIR --format USF --ignore $RULES/asupp --out $USF_FILE.tmp --usf_config $OUTPUT_DIR/$BASENAME.usf_cfg
208   -rm $OUTPUT_DIR/$BASENAME.usf_cfg
  211 +$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
  212 +rm $OUTPUT_DIR/$BASENAME.usf_cfg > /dev/null 2>&1
209 213 cat $USF_FILE.tmp | $SCRIPT_PATH/BdlexUC.pl $RULES/basic -f > $USF_FILE
210 214 cp $USF_FILE ${OUTPUT_DIR}/${BASENAME}.usf
211   -rm $USF_FILE.tmp
  215 +rm $USF_FILE.tmp > /dev/null 2>&1
212 216  
213 217 #----------------#
214 218 # Check USF file #
main_tools/ExploitConfidencePass.sh
... ... @@ -90,10 +90,13 @@
90 90 then
91 91 set -x
92 92 echo -e "## Mode DEBUG ON ##"
  93 + REDIRECTION_OUTPUT=""
  94 + else
  95 + REDIRECTION_OUTPUT=" 2> /dev/null"
93 96 fi
94 97  
95 98 # mode verbose enable
96   -if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ; fi
  99 +if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ;fi
97 100  
98 101 # Check USAGE by arguments number
99 102 if [ $(($#-($OPTIND-1))) -ne 1 ]
... ... @@ -140,10 +143,10 @@
140 143 }
141 144 fi
142 145  
143   -mkdir -p $SHOW_DIR
144   -mkdir -p $SOLR_RES
145   -mkdir -p $EXT_LEX
146   -mkdir -p $TRIGGER_CONFZONE
  146 +mkdir -p $SHOW_DIR > /dev/null 2>&1
  147 +mkdir -p $SOLR_RES > /dev/null 2>&1
  148 +mkdir -p $EXT_LEX > /dev/null 2>&1
  149 +mkdir -p $TRIGGER_CONFZONE > /dev/null 2>&1
147 150  
148 151 #------------------#
149 152 # Create Workspace #
... ... @@ -207,7 +210,7 @@
207 210  
208 211 # Segment ctm into several show files and create a seg list by show
209 212 print_info "Segment ctm into show files and a seg list by show" 2
210   -$SCRIPT_PATH/ctm2show.pl $INPUT_DIR/$BASENAME.ctl $INPUT_DIR/$BASENAME.show.seg $SHOW_DIR
  213 +$SCRIPT_PATH/ctm2show.pl $INPUT_DIR/$BASENAME.ctl $INPUT_DIR/$BASENAME.show.seg $SHOW_DIR $REDIRECTION_OUTPUT
211 214  
212 215 #-----------------------------------------------------------#
213 216 # SOLR QUERIES #
214 217  
... ... @@ -231,10 +234,10 @@
231 234 if [ $(wc -w "$SHOW_DIR/$bn.queries" | cut -f1 -d' ') -gt 0 ]; then
232 235 query=$(cat $SHOW_DIR/$bn.queries)"&fq=docDate:[$datePattern]"
233 236 echo $query > $SHOW_DIR/$bn.queries
234   - python $SCRIPT_PATH/ProcessSOLRQueries.py $SHOW_DIR/$bn.queries $SOLR_RES/$bn.keywords.tmp $SOLR_RES/$bn.txt.tmp
  237 + python $SCRIPT_PATH/ProcessSOLRQueries.py $SHOW_DIR/$bn.queries $SOLR_RES/$bn.keywords.tmp $SOLR_RES/$bn.txt.tmp $REDIRECTION_OUTPUT
235 238 cat $SOLR_RES/$bn.keywords.tmp | sort -u > $SOLR_RES/$bn.keywords
236 239 cat $SOLR_RES/$bn.txt.tmp | sort -u > $SOLR_RES/$bn.txt
237   - rm $SOLR_RES/*.tmp
  240 + rm $SOLR_RES/*.tmp > /dev/null 2>&1
238 241 fi
239 242  
240 243 if [ $CHECK -eq 1 ]
... ... @@ -290,7 +293,7 @@
290 293 # For each treil
291 294 for baseseg in $(cat "$SHOW_DIR/$basename.lst")
292 295 do
293   - $OTMEDIA_HOME/tools/QUOTE_FINDER/bin/acousticFinder ${LEXICON}.speer_phon $RES_CONF/wlat/$baseseg.wlat $TRIGGER_CONFZONE/${basename}.tosearch $SOLR_RES/$basename.phon_oov > $TRIGGER_CONFZONE/$baseseg.acousticlyfound
  296 + $OTMEDIA_HOME/tools/QUOTE_FINDER/bin/acousticFinder ${LEXICON}.speer_phon $RES_CONF/wlat/$baseseg.wlat $TRIGGER_CONFZONE/${basename}.tosearch $SOLR_RES/$basename.phon_oov > $TRIGGER_CONFZONE/$baseseg.acousticlyfound $OUTPUT_REDIRECTION
294 297 #
295 298 # Produce the boost file for the next decoding pass
296 299 #
... ... @@ -331,7 +334,7 @@
331 334 # Extract OOV really added
332 335 #
333 336 cat $SOLR_RES/$basename.phon_oov | cut -f1 | sort -u > $EXT_LEX/$basename.oov
334   - $SCRIPT_PATH/intersec.pl $EXT_LEX/$basename.oov $EXT_LEX/$basename.acousticlyfound > $EXT_LEX/$basename.oov_acousticlyfound
  337 + $SCRIPT_PATH/intersec.pl $EXT_LEX/$basename.oov $EXT_LEX/$basename.acousticlyfound > $EXT_LEX/$basename.oov_acousticlyfound $REDIRECTION_OUTPUT
335 338 #
336 339 # Retrieve all phonetisation
337 340 #
... ... @@ -345,7 +348,7 @@
345 348 lexname=$(basename $LEXICON)
346 349 cat $EXT_LEX/*.oov_acousticlyfound_phon | sort -u > $EXT_LEX/final/all.oov_acousticlyfound_phon
347 350 cat $EXT_LEX/*.oov_acousticlyfound | sort -u | grep --perl-regex -v "^([a-z']){3}$" > $EXT_LEX/final/all.oov_acousticlyfound
348   -$SCRIPT_PATH/MergeLexicon.pl $EXT_LEX/final/all.oov_acousticlyfound_phon > $EXT_LEX/final/${lexname}_ext.phon
  351 +$SCRIPT_PATH/MergeLexicon.pl $EXT_LEX/final/all.oov_acousticlyfound_phon > $EXT_LEX/final/${lexname}_ext.phon $REDIRECTION_OUTPUT
349 352  
350 353 #
351 354 # Collect + clean retrieved txt
... ... @@ -428,7 +431,7 @@
428 431 # Compile the speeral extended lexicon
429 432 #
430 433 print_info "Compile Speeral extended lexicon" 2
431   -$SPEERAL_PATH/bin/buildmappedbinode $LEXICON.bdlex_phon $EXT_LEX/final/${lexname}_ext.map $AM_SKL $EXT_LEX/speeral/${lexname}_ext
  434 +$SPEERAL_PATH/bin/buildmappedbinode $LEXICON.bdlex_phon $EXT_LEX/final/${lexname}_ext.map $AM_SKL $EXT_LEX/speeral/${lexname}_ext $REDIRECTION_OUTPUT
432 435  
433 436 if [ $CHECK -eq 1 ]
434 437 then
main_tools/FirstPass.sh
... ... @@ -87,11 +87,11 @@
87 87 echo -e "## Mode DEBUG ON ##"
88 88 REDIRECTION_OUTPUT=""
89 89 else
90   - REDIRECTION_OUTPUT=" > /dev/null 2>&1"
  90 + REDIRECTION_OUTPUT=" 2> /dev/null"
91 91 fi
92 92  
93 93 # mode verbose enable
94   -if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ; REDIRECTION_OUTPUT=" 2> /dev/null"; fi
  94 +if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ;fi
95 95  
96 96 # Check USAGE by arguments number
97 97 if [ $(($#-($OPTIND-1))) -ne 2 ]
... ... @@ -163,7 +163,7 @@
163 163 else
164 164 rm $RES_DIR/*.lock > /dev/null 2>&1
165 165 fi
166   -mkdir -p $RES_DIR $REDIRECTION_OUTPUT
  166 +mkdir -p $RES_DIR > /dev/null 2>&1
167 167 print_info "Make directory $RES_DIR" 1
168 168  
169 169 #--------------------#
main_tools/OneScriptToRuleThemAll.sh
... ... @@ -104,7 +104,7 @@
104 104 ${MAIN_SCRIPT_PATH}/FirstPass.sh ${RING} $1 $2
105 105 ${MAIN_SCRIPT_PATH}/SecondPass.sh ${RING} ${REP_OUT}
106 106 ${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p2"
107   - ${MAIN_SCRIPT_PATH}/ExploitConfPass.sh ${RING} ${REP_OUT}
  107 + ${MAIN_SCRIPT_PATH}/ExploitConfidencePass.sh ${RING} ${REP_OUT}
108 108 ${MAIN_SCRIPT_PATH}/ThirdPass.sh ${RING} ${REP_OUT}
109 109 ${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p3"
110 110 ${MAIN_SCRIPT_PATH}/RecomposePass.sh ${RING} ${REP_OUT}
main_tools/SecondPass.sh
... ... @@ -85,10 +85,13 @@
85 85 then
86 86 set -x
87 87 echo -e "## Mode DEBUG ON ##"
  88 + REDIRECTION_OUTPUT=""
  89 + else
  90 + REDIRECTION_OUTPUT=" 2> /dev/null"
88 91 fi
89 92  
90 93 # mode verbose enable
91   -if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ; fi
  94 +if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ;fi
92 95  
93 96 # Check USAGE by arguments number
94 97 if [ $(($#-($OPTIND-1))) -ne 1 ]
... ... @@ -149,7 +152,7 @@
149 152 mkdir -p $HMM
150 153 print_info "Make directory $HMM" 1
151 154 if [ $RERUN -eq 0 ]; then rm -r $RES_DIR > /dev/null 2>&1; fi
152   -mkdir -p $RES_DIR
  155 +mkdir -p $RES_DIR > /dev/null 2>&1
153 156 print_info "Make directory $RES_DIR" 1
154 157  
155 158 #-------------------#
... ... @@ -221,7 +224,7 @@
221 224 if [ $RERUN -eq 0 ] || ( [ ! -e $HMM/$speaker.hmm ] || [ -z $HMM/$speaker.hmm ] )
222 225 then
223 226 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
224   - $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/
  227 + $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
225 228 fi
226 229  
227 230 if [ $CHECK -eq 1 ] && ( [ ! -e $HMM/$speaker.hmm ] || [ -z $HMM/$speaker.hmm ] )
... ... @@ -237,7 +240,7 @@
237 240 if [ -s $HMM/$speaker.hmm ] && ( [ $RERUN -eq 0 ] || ( [ ! -e $HMM/$speaker.cls ] || [ -z $HMM/$speaker.cls ] ))
238 241 then
239 242 print_info "$SPEERAL_TOOLS/gclust_pdf $HMM/$speaker.hmm $HMM/$speaker.cls -i $SPEERAL_AM/${MODS[$i]}.cls" 3
240   - $SPEERAL_TOOLS/gclust_pdf $HMM/$speaker.hmm $HMM/$speaker.cls -i $SPEERAL_AM/${MODS[$i]}.cls
  243 + $SPEERAL_TOOLS/gclust_pdf $HMM/$speaker.hmm $HMM/$speaker.cls -i $SPEERAL_AM/${MODS[$i]}.cls $REDIRECTION_OUTPUT
241 244 fi
242 245 if [ $CHECK -eq 1 ] && ( [ ! -e $HMM/$speaker.cls ] || [ -z $HMM/$speaker.cls ] )
243 246 then
244 247  
... ... @@ -248,11 +251,11 @@
248 251 ## Speeral decoding
249 252 if [ -s $HMM/$speaker.hmm ] && [ -s $HMM/$speaker.cls ]
250 253 then
251   - 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" 3
252   - $SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_CFG[$i]} -r $PLP_DIR_P1 -m $HMM/$speaker.hmm -c $HMM/$speaker.cls $FORKS --lock
  254 + 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
  255 + $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
253 256 else
254 257 print_warn "$HMM/$speaker.hmm and $speaker.cls empty, do default decoding..." 2
255   - $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
  258 + $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
256 259 fi
257 260  
258 261 if [ $CHECK -eq 1 ]
259 262  
260 263  
261 264  
... ... @@ -283,20 +286,20 @@
283 286 echo -e "$BASENAME P2 END\n[" >> $LOGFILE
284 287 diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE
285 288 echo -e "] $BASENAME" >> $LOGFILE
286   -rm ${OUTPUT_DIR_BASENAME}/.tmp
  289 +rm ${OUTPUT_DIR_BASENAME}/.tmp > /dev/null 2>&1
287 290  
288 291 #---------------#
289 292 # Convert res #
290 293 #---------------#
291 294  
292 295 # .res => .ctm
293   -$SCRIPT_PATH/res2out.pl --dir $RES_DIR --format CTM --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.2pass.ctm
  296 +$SCRIPT_PATH/res2out.pl --dir $RES_DIR --format CTM --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.2pass.ctm $REDIRECTION_OUTPUT
294 297 # .res => .trs
295 298 echo -e "name $AUTHOR\nfileName ${BASENAME}\nfileExt wav\nsegFile ${OUTPUT_DIR_BASENAME}/${BASENAME}.seg" > ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg
296   -$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
297   -rm ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg
  299 +$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
  300 +rm ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg > /dev/null 2>&1
298 301 # .res => .txt
299   -$SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TXT --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.2pass.txt
  302 +$SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TXT --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.2pass.txt $REDIRECTION_OUTPUT
300 303  
301 304  
302 305 # unlock directory
main_tools/ThirdPass.sh
... ... @@ -83,6 +83,9 @@
83 83 then
84 84 set -x
85 85 echo -e "## Mode DEBUG ON ##"
  86 + REDIRECTION_OUTPUT=""
  87 + else
  88 + REDIRECTION_OUTPUT=" 2> /dev/null"
86 89 fi
87 90  
88 91 # mode verbose enable
89 92  
... ... @@ -191,11 +194,11 @@
191 194 ## Speeral decoding
192 195 if [ -s $HMM/$speaker.hmm ] && [ -s $HMM/$speaker.cls ]
193 196 then
194   - print_info "$SPEERAL_BIN $LST/$speaker.lst $RES_DIR $SPEERAL_THIRD_CFG -r $PLP_DIR_P1 -m $HMM/$speaker.hmm -c $HMM/$speaker.cls $FORKS --lock" 3
195   - $SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_THIRD_CFG} -r $PLP_DIR_P1 -m $HMM/$speaker.hmm -c $HMM/$speaker.cls $FORKS --lock
  197 + print_info "$SPEERAL_BIN $LST/$speaker.lst $RES_DIR $SPEERAL_THIRD_CFG -r $PLP_DIR_P1 -m $HMM/$speaker.hmm -c $HMM/$speaker.cls $FORKS --lock $REDIRECTION_OUTPUT" 3
  198 + $SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_THIRD_CFG} -r $PLP_DIR_P1 -m $HMM/$speaker.hmm -c $HMM/$speaker.cls $FORKS --lock $REDIRECTION_OUTPUT
196 199 else
197 200 print_warn "$HMM/$speaker.hmm and $speaker.cls empty, do default decoding..." 2
198   - $SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_THIRD_CFG} -r $PLP_DIR_P1 -m $SPEERAL_AM/${MODS[$i]}.hmm -c $SPEERAL_AM/${MODS[$i]}.cls $FORKS --lock
  201 + $SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_THIRD_CFG} -r $PLP_DIR_P1 -m $SPEERAL_AM/${MODS[$i]}.hmm -c $SPEERAL_AM/${MODS[$i]}.cls $FORKS --lock $REDIRECTION_OUTPUT
199 202 fi
200 203  
201 204 if [ $CHECK -eq 1 ]
202 205  
203 206  
204 207  
... ... @@ -222,20 +225,20 @@
222 225 echo -e "$BASENAME P3 END\n[" >> $LOGFILE
223 226 diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE
224 227 echo -e "] $BASENAME" >> $LOGFILE
225   -rm ${OUTPUT_DIR_BASENAME}/.tmp
  228 +rm ${OUTPUT_DIR_BASENAME}/.tmp > /dev/null 2>&1
226 229  
227 230 #---------------#
228 231 # Convert res #
229 232 #---------------#
230 233  
231 234 # .res => .ctm
232   -$SCRIPT_PATH/res2out.pl --dir $RES_DIR --format CTM --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.ctm
  235 +$SCRIPT_PATH/res2out.pl --dir $RES_DIR --format CTM --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.ctm $REDIRECTION_OUTPUT
233 236 # .res => .trs
234 237 echo -e "name $AUTHOR\nfileName ${BASENAME}\nfileExt wav\nsegFile ${OUTPUT_DIR_BASENAME}/${BASENAME}.seg" > ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg
235   -$SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TRS --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.trs --trs_config ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg
236   -rm ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg
  238 +$SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TRS --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.trs --trs_config ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg $REDIRECTION_OUTPUT
  239 +rm ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg > /dev/null 2>&1
237 240 # .res => .txt
238   -$SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TXT --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.txt
  241 +$SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TXT --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.txt $REDIRECTION_OUTPUT
239 242  
240 243  
241 244 print_info "<= End $BASENAME P3 | $(date +'%d/%m/%y %H:%M:%S')" 1
tools/scripts/ExtractAudioFromTV.sh
  1 +#!/bin/bash
  2 +
  3 +# File : ExtractAudioFromTV.sh
  4 +# Brief : extract audio file and subtitle from TV corpus
  5 +# version 1.0
  6 +#
  7 +
  8 +### ExtractAudioFromCorpus.sh INA-TV2 MYTV
  9 +
  10 +if [ $(($#-($OPTIND-1))) -ne 2 ]
  11 +then
  12 + echo "BAD USAGE : $0 <INPUT_DIRECTORY> <OUTPUT_DIRECTORY>"
  13 + exit 1
  14 +fi
  15 +
  16 +if [ -e $1 ]
  17 +then
  18 + IN=$(readlink -e $1)
  19 +else
  20 + echo "ERROR : Can't read input $1"
  21 + exit 1
  22 +fi
  23 +
  24 +if [ -e $2 ]
  25 +then
  26 + OUT=$(readlink -e $2)
  27 +else
  28 + echo "ERROR : Can't read OUTPUT $2"
  29 + exit 1
  30 +fi
  31 +
  32 +
  33 +for f in `ls $IN`
  34 +do
  35 + channel=`echo $f | sed -re 's/NAS_//'`
  36 + mkdir $OUT/$channel
  37 + cd $f
  38 + for d in `ls $f`
  39 + do
  40 + for file in `ls ${f}/${d} | grep MP4`
  41 + do
  42 + avconv -i ${IN}/${f}/${d}/${file} -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 ${OUT}/${channel}/${d}_$(basename ${file} .MP4).wav
  43 + if [ -e ${IN}/${f}/${d}/$(basename ${file} .MP4).SRT ]
  44 + then
  45 + cp ${IN}/${f}/${d}/$(basename ${file} .MP4).SRT ${OUT}/${channel}/${d}_$(basename ${file} .MP4).SRT
  46 + fi
  47 + done
  48 + done
  49 +done