Commit 9456401f804acd7976a25465be9d72b733fc4e88
1 parent
135404bcf3
Exists in
master
modify info and log file system in SecondPass and ConPass
Showing 4 changed files with 134 additions and 64 deletions Side-by-side Diff
main_tools/ConfPass.sh
... | ... | @@ -34,7 +34,7 @@ |
34 | 34 | then |
35 | 35 | . $CONFPASS_CONFIG_FILE |
36 | 36 | else |
37 | - echo "ERROR : Can't find configuration file $CONFPASS_CONFIG_FILE" >&2 | |
37 | + echo "ERROR : Can't find configuration file $CONFPASS_CONFIG_FILE" > /dev/stderr | |
38 | 38 | exit 1 |
39 | 39 | fi |
40 | 40 | |
... | ... | @@ -67,7 +67,7 @@ |
67 | 67 | RERUN=1 |
68 | 68 | ;; |
69 | 69 | :) |
70 | - echo "Option -$OPTARG requires an argument." >&2 | |
70 | + echo "Option -$OPTARG requires an argument." > /dev/stderr | |
71 | 71 | exit 1 |
72 | 72 | ;; |
73 | 73 | \?) |
74 | 74 | |
75 | 75 | |
... | ... | @@ -123,17 +123,16 @@ |
123 | 123 | USF_FILE=${INPUT_DIR}/${BASENAME}.${RES_NAME}.usf |
124 | 124 | CONF_DIR="$OUTPUT_DIR/conf/$RES_NAME" |
125 | 125 | RES_CONF_DIR="$OUTPUT_DIR/conf/$RES_NAME/scored_ctm" |
126 | -LOGFILE="$(dirname $OUTPUT_DIR)/info_conf.log" | |
127 | -ERRORFILE="$(dirname $OUTPUT_DIR)/error_conf.log" | |
126 | +LOGFILE="${OUTPUT_DIR_BASENAME}/info_conf.log" | |
127 | +ERRORFILE="${OUTPUT_DIR_BASENAME}/error_conf.log" | |
128 | 128 | |
129 | - | |
130 | 129 | #------------------# |
131 | 130 | # Create Workspace # |
132 | 131 | #------------------# |
133 | 132 | # Lock directory |
134 | 133 | if [ -e "$OUTPUT_DIR/CONFPASS.lock" ] && [ $RERUN -eq 0 ] |
135 | 134 | then |
136 | - print_info "Confpass lock $INPUT_DIR -> exit" 1 | |
135 | + print_warn "[${BASENAME}] Confpass is locked -> exit" 2 | |
137 | 136 | exit 1 |
138 | 137 | fi |
139 | 138 | rm "$OUTPUT_DIR/CONFPASS.unlock" > /dev/null 2>&1 |
140 | 139 | |
141 | 140 | |
142 | 141 | |
143 | 142 | |
144 | 143 | |
145 | 144 | |
146 | 145 | |
147 | 146 | |
148 | 147 | |
... | ... | @@ -142,43 +141,71 @@ |
142 | 141 | if [ $RERUN -eq 1 ]; then rm $USF_FILE > /dev/null 2>&1; fi |
143 | 142 | mkdir -p $CONF_DIR > /dev/null 2>&1 |
144 | 143 | mkdir -p $RES_CONF_DIR > /dev/null 2>&1 |
144 | +rm $LOGFILE $ERRORFILE > /dev/null 2>&1 | |
145 | 145 | |
146 | 146 | #---------------# |
147 | 147 | # Check Pass # |
148 | 148 | #---------------# |
149 | - | |
150 | -# if usf contains more than 40% of 0.600 confidence -> usf error | |
149 | +print_info "[${BASENAME}] Check Conf Pass directory ${RES_NAME}" 1 | |
150 | +# if usf contains more than 49% of 0.600 confidence -> usf error | |
151 | 151 | if [ -s $USF_FILE ] |
152 | 152 | then |
153 | 153 | conftozerosix=$(grep -c -E 'confidence="0.600"' "${USF_FILE}") |
154 | - conftoother=$(grep -c -v -E 'confidence="0.600"' "${USF_FILE}") | |
155 | - if [ $conftoother -gt 0 ] | |
154 | + confall=$(grep -c -E 'confidence=' "${USF_FILE}") | |
155 | + if [ $confall -gt 0 ] | |
156 | 156 | then |
157 | - pourcentageofzerosix=$((($conftozerosix*100)/$conftoother)) | |
158 | - if [ $pourcentageofzerosix -gt 40 ] | |
157 | + pourcentageofzerosix=$((($conftozerosix*100)/$confall)) | |
158 | + if [ $pourcentageofzerosix -gt 49 ] | |
159 | 159 | then |
160 | - print_warn "${USF_FILE} got $pourcentageofzerosix% of 0.6 confidence" 1 | |
160 | + print_warn "[${BASENAME}] ${BASENAME}.${RES_NAME}.usf got $pourcentageofzerosix% of 0.600 confidence" 2 | |
161 | + print_info "[${BASENAME}] bad usf ${RES_NAME}, will do it again" 1 | |
161 | 162 | mv "${USF_FILE}" "${USF_FILE}.back" |
162 | 163 | rm -r $CONF_DIR > /dev/null 2>&1 |
163 | 164 | else |
164 | - print_warn "${USF_FILE} already done, skipping it" 1 | |
165 | + print_warn "[${BASENAME}] ${USF_FILE} already done, skipping it" 1 | |
165 | 166 | exit 0 |
166 | 167 | fi |
167 | 168 | fi |
169 | +else | |
170 | + print_info "[${BASENAME}] No USF file already done, continue..." 1 | |
168 | 171 | fi |
169 | 172 | |
173 | +# Check if treil are here | |
174 | +nbres_p1=$(cat ${INPUT_DIR}/plp.lst | wc -l) | |
175 | +nbtreil_p=$(ls $RES_P/*.treil 2> /dev/null | wc -l) | |
176 | +if [ $nbtreil_p -eq 0 ] | |
177 | +then | |
178 | + print_error "[${BASENAME}] No ${RES_NAME} Pass, No .treil -> exit ConfPass" | |
179 | + if [ $CHECK -eq 1 ]; then print_log_file $ERRORFILE "No ${RES_NAME} Pass, No .treil -> exit ConfPass" ;fi | |
180 | + exit 1 | |
181 | +else | |
182 | + #Check if more then 89% of treil are done | |
183 | + if [ $nbres_p1 -gt 0 ] | |
184 | + then | |
185 | + pourcentage=$((($nbtreil_p*100)/$nbres_p1)) | |
186 | + if [ $pourcentage -gt 89 ] | |
187 | + then | |
188 | + print_info "[${BASENAME}] ${RES_NAME}/*.treil are here" 1 | |
189 | + else | |
190 | + print_warn "[${BASENAME}] not enough ${RES_NAME} treil" 2 | |
191 | + if [ $CHECK -eq 1 ]; then print_log_file $ERRORFILE "Not enough ${RES_NAME} treil " | |
192 | + fi | |
193 | + fi | |
194 | +fi | |
195 | + | |
170 | 196 | #------# |
171 | 197 | # Save # |
172 | 198 | #------# |
173 | 199 | cp $CONFPASS_CONFIG_FILE $OUTPUT_DIR/ConfPass.cfg |
174 | 200 | echo "RES_CONF_DIR=$RES_CONF_DIR" >> $OUTPUT_DIR/ConfPass.cfg |
175 | 201 | echo "CONF_DIR=$CONF_DIR" >> $OUTPUT_DIR/ConfPass.cfg |
202 | +print_info "[${BASENAME}] Save config in $OUTPUT_DIR_BASENAME/ConfPass.cfg" 1 | |
176 | 203 | |
177 | 204 | #--------------------# |
178 | 205 | # CONFIDENCE MEASURE # |
179 | 206 | #--------------------# |
180 | 207 | |
181 | -# Check pourcentage of scored_ctm already done, if < 85% done confidence measure | |
208 | +# Check pourcentage of scored_ctm already done, if < 85% do confidence measure | |
182 | 209 | nbres_p=$(ls ${RES_P}/*.treil | wc -l) |
183 | 210 | nbconf=$(ls ${RES_CONF_DIR}/*.res | wc -l) |
184 | 211 | if [ $nbres_p -gt 0 ] |
185 | 212 | |
... | ... | @@ -186,11 +213,11 @@ |
186 | 213 | pourcentageres=$((($nbconf*100)/$nbres_p)) |
187 | 214 | if [ $pourcentageres -lt 85 ] |
188 | 215 | then |
189 | - print_info "Calcul Confidence $INPUT_DIR $RES_NAME" 1 | |
216 | + print_info "[${BASENAME}] Calcul Confidence $INPUT_DIR $RES_NAME" 1 | |
190 | 217 | $MAIN_SCRIPT_PATH/ConfidenceMeasure.sh $INPUT_DIR $RES_NAME $REDIRECTION_OUTPUT |
191 | 218 | |
192 | 219 | else |
193 | - print_info "skipping Confidence Calcul $INPUT_DIR/$RES_NAME" 1 | |
220 | + print_info "[${BASENAME}] Skipping Confidence Calcul $INPUT_DIR/$RES_NAME" 1 | |
194 | 221 | fi |
195 | 222 | fi |
196 | 223 | |
197 | 224 | |
198 | 225 | |
... | ... | @@ -198,16 +225,22 @@ |
198 | 225 | if [ $CHECK -eq 1 ] |
199 | 226 | then |
200 | 227 | nbconf=$(ls ${RES_CONF_DIR}/*.res | wc -l) |
201 | - if [ $nbres_p -ne $nbconf ];then echo "WARN : ConfPass $INPUT_DIR/$RES_NAME number of res files differ" >> $LOGFILE;fi | |
228 | + if [ $nbres_p -ne $nbconf ] | |
229 | + then | |
230 | + print_warn "WARN : ConfPass $INPUT_DIR/$RES_NAME number of res files differ" 2 | |
231 | + print_log_file $LOGFILE "WARN : ConfPass $INPUT_DIR/$RES_NAME number of res files differ" | |
232 | + fi | |
202 | 233 | fi |
203 | 234 | |
204 | 235 | #---------------------------# |
205 | 236 | # FROM RES WITH CONF => USF # |
206 | 237 | #---------------------------# |
238 | +print_info "[${BASENAME}] Create USF file for $RES_P" 1 | |
207 | 239 | for f in `ls ${RES_CONF_DIR}`; do $SCRIPT_PATH/formatRES.pl $RES_CONF_DIR/$f; done |
208 | 240 | # create USF configuration file |
209 | 241 | echo -e "name $AUTHOR\nfileName $BASENAME\nfileExt wav\nsegFile $OUTPUT_DIR/$BASENAME.seg" > $OUTPUT_DIR/$BASENAME.usf_cfg |
210 | 242 | # create USF file |
243 | +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 | |
211 | 244 | $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 | 245 | rm $OUTPUT_DIR/$BASENAME.usf_cfg > /dev/null 2>&1 |
213 | 246 | cat $USF_FILE.tmp | $SCRIPT_PATH/BdlexUC.pl $RULES/basic -f > $USF_FILE |
... | ... | @@ -222,7 +255,8 @@ |
222 | 255 | check_conf_pass_usf "$OUTPUT_DIR/$BASENAME.usf" |
223 | 256 | if [ $? -eq 1 ] |
224 | 257 | then |
225 | - echo -e "ERROR : Wrong confidence measures in USF file : $OUTPUT_DIR/$BASENAME.usf" >> $ERRORFILE | |
258 | + print_error "[${BASENAME}] Wrong confidence measures in USF file : $OUTPUT_DIR/$BASENAME.usf" | |
259 | + print_log_file $ERRORFILE "ERROR : Wrong confidence measures in USF file : $OUTPUT_DIR/$BASENAME.usf" | |
226 | 260 | exit 1 |
227 | 261 | fi |
228 | 262 | fi |
... | ... | @@ -231,8 +265,7 @@ |
231 | 265 | # CLOSE # |
232 | 266 | #-------# |
233 | 267 | # Seem OK |
234 | -print_info "<= End $BASENAME ConfPass | $(date +'%d/%m/%y %H:%M:%S')" 1 | |
235 | -echo -e "ConfPass $BASENAME OK" >> $LOGFILE | |
268 | +print_info "[${BASENAME}] <= ConfPass End | $(date +'%d/%m/%y %H:%M:%S')" 1 | |
236 | 269 | |
237 | 270 | # unlock directory |
238 | 271 | mv "$OUTPUT_DIR/CONFPASS.lock" "$OUTPUT_DIR/CONFPASS.unlock" |
main_tools/FirstPass.sh
... | ... | @@ -71,11 +71,11 @@ |
71 | 71 | RERUN=1 |
72 | 72 | ;; |
73 | 73 | :) |
74 | - echo "Option -$OPTARG requires an argument." >&2 | |
74 | + echo "Option -$OPTARG requires an argument." > /dev/stderr | |
75 | 75 | exit 1 |
76 | 76 | ;; |
77 | 77 | \?) |
78 | - echo "BAD USAGE : unknow opton -$OPTARG" | |
78 | + echo "BAD USAGE : unknow opton -$OPTARG" | |
79 | 79 | exit 1 |
80 | 80 | ;; |
81 | 81 | esac |
... | ... | @@ -182,7 +182,7 @@ |
182 | 182 | echo "SEG_FILE=$SEG_FILE" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg |
183 | 183 | echo "LBL_FILE=$LBL_FILE" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg |
184 | 184 | echo "RES_DIR=$RES_DIR" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg |
185 | -print_info "[${BASENAME}] save config in $OUTPUT_DIR_BASENAME/FirstPass.cfg" 1 | |
185 | +print_info "[${BASENAME}] Save config in $OUTPUT_DIR_BASENAME/FirstPass.cfg" 1 | |
186 | 186 | |
187 | 187 | #-------------------------# |
188 | 188 | # Check Audio File Format # |
... | ... | @@ -248,7 +248,7 @@ |
248 | 248 | if [ $CHECK -eq 1 ] && ( [ ! -e $SEG_FILE ] || [ -z $SEG_FILE ] ) |
249 | 249 | then |
250 | 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 | |
251 | + print_error "[${BASENAME}] ERROR : check $ERRORFILE file" | |
252 | 252 | exit 1 |
253 | 253 | fi |
254 | 254 | |
... | ... | @@ -261,7 +261,7 @@ |
261 | 261 | if [ $CHECK -eq 1 ] && ( [ ! -e $LBL_FILE ] || [ -z $LBL_FILE ] ) |
262 | 262 | then |
263 | 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 | |
264 | + print_error "[${BASENAME}] ERROR : check $ERRORFILE file" | |
265 | 265 | exit 1 |
266 | 266 | fi |
267 | 267 | |
... | ... | @@ -280,7 +280,7 @@ |
280 | 280 | if [ $? -eq 1 ] |
281 | 281 | then |
282 | 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 | |
283 | + print_error "[${BASENAME}] ERROR : check $ERRORFILE file" | |
284 | 284 | exit 1 |
285 | 285 | fi |
286 | 286 | fi |
... | ... | @@ -371,7 +371,7 @@ |
371 | 371 | then |
372 | 372 | print_error "[${BASENAME}] ERROR : check $ERRORFILE" |
373 | 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 | |
374 | + diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $ERRORFILE | |
375 | 375 | print_log_file "$ERRORFILE" "] $pourcentage% $BASENAME" |
376 | 376 | else |
377 | 377 | print_log_file "$LOGFILE" "P1 OK $BASENAME | $(date +'%d/%m/%y %H:%M:%S')" |
main_tools/SecondPass.sh
... | ... | @@ -33,7 +33,8 @@ |
33 | 33 | then |
34 | 34 | . $SECONDPASS_CONFIG_FILE |
35 | 35 | else |
36 | - echo "ERROR : Can't find configuration file $SECONDPASS_CONFIG_FILE" >&2 | |
36 | + echo "ERROR : Can't find configuration file $SECONDPASS_CONFIG_FILE" > /dev/stderr | |
37 | + echo "exit" > /dev/stderr | |
37 | 38 | exit 1 |
38 | 39 | fi |
39 | 40 | |
40 | 41 | |
... | ... | @@ -70,11 +71,11 @@ |
70 | 71 | RERUN=1 |
71 | 72 | ;; |
72 | 73 | :) |
73 | - echo "Option -$OPTARG requires an argument." >&2 | |
74 | + echo "Option -$OPTARG requires an argument." > /dev/stderr | |
74 | 75 | exit 1 |
75 | 76 | ;; |
76 | 77 | \?) |
77 | - echo "BAD USAGE : unknow opton -$OPTARG" | |
78 | + echo "BAD USAGE : unknow opton -$OPTARG" > /dev/stderr | |
78 | 79 | exit 1 |
79 | 80 | ;; |
80 | 81 | esac |
... | ... | @@ -111,6 +112,8 @@ |
111 | 112 | exit 1 |
112 | 113 | fi |
113 | 114 | |
115 | +print_info "[${BASENAME}] => P2 start | $(date +'%d/%m/%y %H:%M:%S')" 1 | |
116 | + | |
114 | 117 | #-------------# |
115 | 118 | # GLOBAL VARS # |
116 | 119 | #-------------# |
117 | 120 | |
118 | 121 | |
119 | 122 | |
120 | 123 | |
121 | 124 | |
122 | 125 | |
123 | 126 | |
... | ... | @@ -128,44 +131,46 @@ |
128 | 131 | RES_DIR_P1=$(cat $FIRSTPASS_CONFIG_FILE | grep "RES_DIR=" | cut -f2 -d"=") |
129 | 132 | else |
130 | 133 | print_error "can't find $FIRSTPASS_CONFIG_FILE file" |
134 | + print_error "exit" | |
131 | 135 | exit 1 |
132 | 136 | fi |
133 | 137 | LST=$OUTPUT_DIR_BASENAME"/lists" |
134 | 138 | HMM=$OUTPUT_DIR_BASENAME"/hmm/" |
135 | 139 | RES_DIR=$OUTPUT_DIR_BASENAME"/res_p2" |
136 | -LOGFILE="$OUTPUT_DIR/info_p2.log" | |
137 | -ERRORFILE="$OUTPUT_DIR/error_p2.log" | |
140 | +LOGFILE="$OUTPUT_DIR_BASENAME/info_p2.log" | |
141 | +ERRORFILE="$OUTPUT_DIR_BASENAME/error_p2.log" | |
138 | 142 | |
139 | 143 | #------------------# |
140 | 144 | # Create WORKSPACE # |
141 | 145 | #------------------# |
142 | 146 | |
143 | 147 | # Lock directory |
144 | -if [ -e $OUTPUT_DIR_BASENAME/SECONDPASS.lock ] && [ $RERUN -eq 0 ]; then exit 1;fi | |
148 | +if [ -e $OUTPUT_DIR_BASENAME/SECONDPASS.lock ] && [ $RERUN -eq 0 ]; then print_warn "[${BASENAME}] SECONDPASS is locked -> exit" 2; exit 1;fi | |
145 | 149 | rm "$OUTPUT_DIR_BASENAME/SECONDPASS.unlock" > /dev/null 2>&1 |
146 | 150 | touch "$OUTPUT_DIR_BASENAME/SECONDPASS.lock" > /dev/null 2>&1 |
147 | 151 | |
148 | 152 | rm -r $LST > /dev/null 2>&1 |
149 | 153 | mkdir -p $LST |
150 | -print_info "Make directory $LST" 1 | |
154 | +print_info "[${BASENAME}] Make directory $LST" 2 | |
151 | 155 | if [ $RERUN -eq 0 ]; then rm -r $HMM > /dev/null 2>&1; fi |
152 | 156 | mkdir -p $HMM |
153 | -print_info "Make directory $HMM" 1 | |
157 | +print_info "[${BASENAME}] Make directory $HMM" 2 | |
154 | 158 | if [ $RERUN -eq 0 ]; then rm -r $RES_DIR > /dev/null 2>&1; fi |
155 | 159 | mkdir -p $RES_DIR > /dev/null 2>&1 |
156 | -print_info "Make directory $RES_DIR" 1 | |
160 | +print_info "[${BASENAME}] Make directory $RES_DIR" 2 | |
161 | +rm $LOGFILE $ERRORFILE > /dev/null 2>&1 | |
157 | 162 | |
158 | 163 | #-------------------# |
159 | 164 | # Check Pass # |
160 | 165 | #-------------------# |
161 | -print_info "Check Pass 2 directory" 1 | |
166 | +print_info "[${BASENAME}] Check Pass 2 directory" 1 | |
162 | 167 | for treil in $(ls $RES_DIR/ | grep treil) |
163 | 168 | do |
164 | 169 | if [ ! -s $RES_DIR/$treil ] |
165 | 170 | then |
166 | 171 | bn = $(basename $treil ".treil") |
167 | 172 | rm $RES_DIR/$treil $RES_DIR/$bn.seg $RES_DIR/$bn.res $RES_DIR/$bn.pho 2> /dev/null |
168 | - print_info "$RES_DIR/$bn.* files deleted.." 2 | |
173 | + print_info "[${BASENAME}] $RES_DIR/$bn.* files deleted.." 2 | |
169 | 174 | fi |
170 | 175 | done |
171 | 176 | |
172 | 177 | |
... | ... | @@ -177,9 +182,13 @@ |
177 | 182 | pourcentage=$((($nbtreil_p2*100)/$nbres_p1)) |
178 | 183 | if [ $pourcentage -gt 89 ] |
179 | 184 | then |
180 | - echo "Lattice already done, skipping $BASENAME" | |
185 | + print_info "[${BASENAME}] Lattice already done, skipping $BASENAME" 1 | |
181 | 186 | exit 0 |
182 | 187 | fi |
188 | +else | |
189 | + print_error "[${BASENAME}] No First Pass, No .res -> exit P2" | |
190 | + if [ $CHECK -eq 1 ]; then print_log_file $ERRORFILE "No First Pass, No .res -> exit P2" ;fi | |
191 | + exit 1 | |
183 | 192 | fi |
184 | 193 | |
185 | 194 | #--------------------# |
186 | 195 | |
187 | 196 | |
... | ... | @@ -195,20 +204,20 @@ |
195 | 204 | echo "LST=$LST" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg |
196 | 205 | echo "HMM=$HMM" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg |
197 | 206 | echo "RES_DIR=$RES_DIR" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg |
198 | -print_info "save config in $OUTPUT_DIR_BASENAME/SecondPass.cfg" 1 | |
207 | +print_info "[${BASENAME}] Save config in $OUTPUT_DIR_BASENAME/SecondPass.cfg" 1 | |
199 | 208 | |
200 | 209 | |
201 | 210 | #--------------------------------------------------# |
202 | 211 | # Speaker Adaptation (AM) + Second pass (DECODING) # |
203 | 212 | #--------------------------------------------------# |
204 | -print_info "Launch Second Pass" 1 | |
213 | +print_info "[${BASENAME}] Launch Second Pass" 1 | |
205 | 214 | |
206 | 215 | # for all speaker |
207 | 216 | for speaker in $(cat $LBL_FILE_P1 | cut -f4 -d" " | sort | uniq) |
208 | 217 | do |
209 | 218 | ## get seg file from P1 containing the speaker |
210 | 219 | find $RES_DIR_P1 -name "*${speaker}.seg" -exec basename "{}" .seg \; | sort > $LST/$speaker.lst |
211 | - print_info "file for $speaker in $LST/$speaker.lst" 3 | |
220 | + print_info "[${BASENAME}] file for $speaker in $LST/$speaker.lst" 3 | |
212 | 221 | if [ ! -s $LST/$speaker.lst ]; then print_warn "no ${speaker} file in $RES_DIR_P1" 3; continue; fi |
213 | 222 | |
214 | 223 | |
215 | 224 | |
... | ... | @@ -223,13 +232,15 @@ |
223 | 232 | ## HMM adaptation |
224 | 233 | if [ $RERUN -eq 0 ] || ( [ ! -e $HMM/$speaker.hmm ] || [ -z $HMM/$speaker.hmm ] ) |
225 | 234 | then |
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 | |
235 | + 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 | |
227 | 236 | $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 |
228 | 237 | fi |
229 | 238 | |
230 | 239 | if [ $CHECK -eq 1 ] && ( [ ! -e $HMM/$speaker.hmm ] || [ -z $HMM/$speaker.hmm ] ) |
231 | 240 | then |
232 | - echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $HMM/$speaker.hmm" >> $ERRORFILE | |
241 | + print_warn "[${BASENAME}] No hmm files created for $speaker" 2 | |
242 | + print_log_file $ERRORFILE "ERROR [$(date +'%d/%m/%y %H:%M:%S')] No hmm files created for $speaker" | |
243 | + print_error "[${BASENAME}] Check $ERRORFILE" | |
233 | 244 | #exit 1 |
234 | 245 | fi |
235 | 246 | |
236 | 247 | |
237 | 248 | |
238 | 249 | |
... | ... | @@ -239,22 +250,25 @@ |
239 | 250 | ## class clustering |
240 | 251 | if [ -s $HMM/$speaker.hmm ] && ( [ $RERUN -eq 0 ] || ( [ ! -e $HMM/$speaker.cls ] || [ -z $HMM/$speaker.cls ] )) |
241 | 252 | then |
242 | - print_info "$SPEERAL_TOOLS/gclust_pdf $HMM/$speaker.hmm $HMM/$speaker.cls -i $SPEERAL_AM/${MODS[$i]}.cls" 3 | |
253 | + print_info "[${BASENAME}] $SPEERAL_TOOLS/gclust_pdf $HMM/$speaker.hmm $HMM/$speaker.cls -i $SPEERAL_AM/${MODS[$i]}.cls" 3 | |
243 | 254 | $SPEERAL_TOOLS/gclust_pdf $HMM/$speaker.hmm $HMM/$speaker.cls -i $SPEERAL_AM/${MODS[$i]}.cls $REDIRECTION_OUTPUT |
244 | 255 | fi |
245 | 256 | if [ $CHECK -eq 1 ] && ( [ ! -e $HMM/$speaker.cls ] || [ -z $HMM/$speaker.cls ] ) |
246 | 257 | then |
247 | - echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $HMM/$speaker.cls" >> $ERRORFILE | |
258 | + print_warn "[${BASENAME}] No cls file created for $speaker" 2 | |
259 | + print_log_file $ERRORFILE "ERROR [$(date +'%d/%m/%y %H:%M:%S')] No cls file created for $speakers" | |
260 | + print_error "[${BASENAME}] Check $ERRORFILE" | |
248 | 261 | #exit 1 |
249 | 262 | fi |
250 | 263 | |
251 | 264 | ## Speeral decoding |
252 | 265 | if [ -s $HMM/$speaker.hmm ] && [ -s $HMM/$speaker.cls ] |
253 | 266 | then |
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 | |
267 | + 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 | |
255 | 268 | $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 |
256 | 269 | else |
257 | - print_warn "$HMM/$speaker.hmm and $speaker.cls empty, do default decoding..." 2 | |
270 | + print_warn "[${BASENAME}] $HMM/$speaker.hmm and $speaker.cls empty, do default decoding..." 2 | |
271 | + 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 | |
258 | 272 | $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 |
259 | 273 | fi |
260 | 274 | |
261 | 275 | |
... | ... | @@ -263,10 +277,12 @@ |
263 | 277 | check_second_pass_output_speeral "$LST/$speaker.lst" "$RES_DIR" |
264 | 278 | if [ $? -eq 1 ] |
265 | 279 | then |
266 | - echo -e "ERROR : Speeral $LST/$speaker.lst\n[" >> $ERRORFILE | |
280 | + print_warn "[${BASENAME}] Speeral output error : check $LOGFILE" 2 | |
281 | + print_log_file $LOGFILE "WARN : Speeral number of output ERROR $LST/$speaker.lst" | |
267 | 282 | ls $RES_DIR/*.seg | grep -e "$speaker" | sed -e "s|$RES_DIR\/||" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp |
268 | - diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp >> $ERRORFILE | |
269 | - echo -e "] " >> $ERRORFILE | |
283 | + print_log_file $LOGFILE "Segs (and treil) not done :\n[" | |
284 | + diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp >> $LOGFILE | |
285 | + print_log_file $LOGFILE "] [$(date +'%d/%m/%y %H:%M:%S')]" | |
270 | 286 | rm ${OUTPUT_DIR_BASENAME}/.tmp |
271 | 287 | #exit 1 |
272 | 288 | fi |
273 | 289 | |
274 | 290 | |
275 | 291 | |
276 | 292 | |
277 | 293 | |
... | ... | @@ -279,29 +295,43 @@ |
279 | 295 | #rm "$LST/$speaker.lst" > /dev/null 2>&1 |
280 | 296 | done |
281 | 297 | |
282 | -print_info "<= End $BASENAME P2 | $(date +'%d/%m/%y %H:%M:%S')" 1 | |
283 | - | |
284 | 298 | ## Check missing seg and log it |
285 | -ls $RES_DIR/*.treil | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.treil//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp | |
286 | -echo -e "$BASENAME P2 END\n[" >> $LOGFILE | |
287 | -diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE | |
288 | -echo -e "] $BASENAME" >> $LOGFILE | |
289 | -rm ${OUTPUT_DIR_BASENAME}/.tmp > /dev/null 2>&1 | |
299 | +if [ $CHECK -eq 1 ] | |
300 | +then | |
301 | + ls $RES_DIR/*.treil | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.treil//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp | |
302 | + todo=$(cat ${PLP_FILE_P1} | wc -l) | |
303 | + if [ $todo -eq 0 ]; then todo=1;fi | |
304 | + notdone=$(($todo - $(cat ${OUTPUT_DIR_BASENAME}/.tmp | wc -l))) | |
305 | + pourcentage=$((($notdone*100)/$todo)) | |
306 | + if [ $notdone -ne 0 ] | |
307 | + then | |
308 | + print_error "[${BASENAME}] ERROR : check $ERRORFILE" | |
309 | + print_log_file "$ERRORFILE" "ERROR : Treil not done [" | |
310 | + diff ${PLP_FILE_P1} ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $ERRORFILE | |
311 | + print_log_file "$ERRORFILE" "] $pourcentage% $BASENAME" | |
312 | + else | |
313 | + print_log_file "$LOGFILE" "P1 OK $BASENAME | $(date +'%d/%m/%y %H:%M:%S')" | |
314 | + fi | |
315 | + rm ${OUTPUT_DIR_BASENAME}/.tmp > /dev/null 2>&1 | |
316 | +fi | |
290 | 317 | |
291 | 318 | #---------------# |
292 | 319 | # Convert res # |
293 | 320 | #---------------# |
294 | 321 | |
322 | +print_info "[${BASENAME}] Convert .res into .ctm" 1 | |
295 | 323 | # .res => .ctm |
296 | 324 | $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format CTM --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.2pass.ctm $REDIRECTION_OUTPUT |
325 | +print_info "[${BASENAME}] Convert .res into .trs" 1 | |
297 | 326 | # .res => .trs |
298 | 327 | echo -e "name $AUTHOR\nfileName ${BASENAME}\nfileExt wav\nsegFile ${OUTPUT_DIR_BASENAME}/${BASENAME}.seg" > ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg |
299 | 328 | $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 | 329 | rm ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg > /dev/null 2>&1 |
330 | +print_info "[${BASENAME}] Convert .res into .txt" 1 | |
301 | 331 | # .res => .txt |
302 | 332 | $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TXT --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.2pass.txt $REDIRECTION_OUTPUT |
303 | 333 | |
304 | - | |
334 | +print_info "[${BASENAME}] <= P2 End | $(date +'%d/%m/%y %H:%M:%S')" 1 | |
305 | 335 | # unlock directory |
306 | 336 | mv "$OUTPUT_DIR_BASENAME/SECONDPASS.lock" "$OUTPUT_DIR_BASENAME/SECONDPASS.unlock" |
tools/scripts/CheckConfPass.sh
... | ... | @@ -20,16 +20,23 @@ |
20 | 20 | then |
21 | 21 | if [ -e "$1" ] && [ -s "$1" ] |
22 | 22 | then |
23 | - temp=`grep -c -E 'confidence="0.600"' "$1"` | |
24 | - if [ $temp -gt 200 ] | |
23 | + conftozerosix=$(grep -c -E 'confidence="0.600"' "$1") | |
24 | + confall=$(grep -c -E 'confidence=' "$1") | |
25 | + if [ $confall -gt 0 ] | |
25 | 26 | then |
26 | - return 1 | |
27 | + pourcentageofzerosix=$((($conftozerosix*100)/$confall)) | |
28 | + if [ $pourcentageofzerosix -gt 49 ] | |
29 | + then | |
30 | + return 1 | |
31 | + | |
32 | + else | |
33 | + return 0 | |
34 | + fi | |
27 | 35 | fi |
28 | 36 | else |
29 | 37 | return 1 |
30 | 38 | fi |
31 | 39 | fi |
32 | - | |
33 | 40 | return 0 |
34 | 41 | } |