Commit 8425b854971d04c354cc71d6355e290e6d2f7989
1 parent
1c85f8188a
Exists in
master
bug in configuration file saved
Showing 2 changed files with 2 additions and 1 deletions Inline Diff
main_tools/SecondPass.sh
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | ##################################################### | 3 | ##################################################### |
4 | # File : SecondPass.sh # | 4 | # File : SecondPass.sh # |
5 | # Brief : Speaker adaptation + ASR second pass # | 5 | # Brief : Speaker adaptation + ASR second pass # |
6 | # Author : Jean-François Rey # | 6 | # Author : Jean-François Rey # |
7 | # (base on Emmanuel Ferreira # | 7 | # (base on Emmanuel Ferreira # |
8 | # and Hugo Mauchrétien works) # | 8 | # and Hugo Mauchrétien works) # |
9 | # Version : 1.1 # | 9 | # Version : 1.1 # |
10 | # Date : 18/06/13 # | 10 | # Date : 18/06/13 # |
11 | ##################################################### | 11 | ##################################################### |
12 | 12 | ||
13 | echo "### SecondPass.sh ###" | 13 | echo "### SecondPass.sh ###" |
14 | 14 | ||
15 | # Check OTMEDIA_HOME env var | 15 | # Check OTMEDIA_HOME env var |
16 | if [ -z ${OTMEDIA_HOME} ] | 16 | if [ -z ${OTMEDIA_HOME} ] |
17 | then | 17 | then |
18 | OTMEDIA_HOME=$(dirname $(dirname $(readlink -e $0))) | 18 | OTMEDIA_HOME=$(dirname $(dirname $(readlink -e $0))) |
19 | export OTMEDIA_HOME=$OTMEDIA_HOME | 19 | export OTMEDIA_HOME=$OTMEDIA_HOME |
20 | fi | 20 | fi |
21 | 21 | ||
22 | # where is SecondPass.sh | 22 | # where is SecondPass.sh |
23 | MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0)) | 23 | MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0)) |
24 | 24 | ||
25 | # Scripts Path | 25 | # Scripts Path |
26 | SCRIPT_PATH=$OTMEDIA_HOME/tools/scripts | 26 | SCRIPT_PATH=$OTMEDIA_HOME/tools/scripts |
27 | 27 | ||
28 | # Include scripts | 28 | # Include scripts |
29 | . $SCRIPT_PATH"/Tools.sh" | 29 | . $SCRIPT_PATH"/Tools.sh" |
30 | . $SCRIPT_PATH"/CheckSecondPass.sh" | 30 | . $SCRIPT_PATH"/CheckSecondPass.sh" |
31 | 31 | ||
32 | # where is SecondPass.cfg | 32 | # where is SecondPass.cfg |
33 | SECONDPASS_CONFIG_FILE=$OTMEDIA_HOME"/cfg/SecondPass.cfg" | 33 | SECONDPASS_CONFIG_FILE=$OTMEDIA_HOME"/cfg/SecondPass.cfg" |
34 | if [ -e $SECONDPASS_CONFIG_FILE ] | 34 | if [ -e $SECONDPASS_CONFIG_FILE ] |
35 | then | 35 | then |
36 | . $SECONDPASS_CONFIG_FILE | 36 | . $SECONDPASS_CONFIG_FILE |
37 | else | 37 | else |
38 | echo "ERROR : Can't find configuration file $SECONDPASS_CONFIG_FILE" >&2 | 38 | echo "ERROR : Can't find configuration file $SECONDPASS_CONFIG_FILE" >&2 |
39 | echo "exit" >&2 | 39 | echo "exit" >&2 |
40 | exit 1 | 40 | exit 1 |
41 | fi | 41 | fi |
42 | 42 | ||
43 | #---------------# | 43 | #---------------# |
44 | # Parse Options # | 44 | # Parse Options # |
45 | #---------------# | 45 | #---------------# |
46 | while getopts ":hDv:crf:" opt | 46 | while getopts ":hDv:crf:" opt |
47 | do | 47 | do |
48 | case $opt in | 48 | case $opt in |
49 | h) | 49 | h) |
50 | echo -e "$0 [OPTIONS] <FIRST_PASS_DIRECTORY>\n" | 50 | echo -e "$0 [OPTIONS] <FIRST_PASS_DIRECTORY>\n" |
51 | echo -e "\t Options:" | 51 | echo -e "\t Options:" |
52 | echo -e "\t\t-h :\tprint this message" | 52 | echo -e "\t\t-h :\tprint this message" |
53 | echo -e "\t\t-D :\tDEBUG mode on" | 53 | echo -e "\t\t-D :\tDEBUG mode on" |
54 | echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode" | 54 | echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode" |
55 | echo -e "\t\t-c :\t Check process, stop if error detected" | 55 | echo -e "\t\t-c :\t Check process, stop if error detected" |
56 | echo -e "\t\t-f n :\tSpecify speeral forks number (default 1)" | 56 | echo -e "\t\t-f n :\tSpecify speeral forks number (default 1)" |
57 | echo -e "\t\t-r n :\tforce rerun the show, without deleting works already done" | 57 | echo -e "\t\t-r n :\tforce rerun the show, without deleting works already done" |
58 | exit 1 | 58 | exit 1 |
59 | ;; | 59 | ;; |
60 | D) | 60 | D) |
61 | DEBUG=1 | 61 | DEBUG=1 |
62 | ;; | 62 | ;; |
63 | v) | 63 | v) |
64 | VERBOSE=$OPTARG | 64 | VERBOSE=$OPTARG |
65 | ;; | 65 | ;; |
66 | c) | 66 | c) |
67 | CHECK=1 | 67 | CHECK=1 |
68 | ;; | 68 | ;; |
69 | f) | 69 | f) |
70 | FORKS="--forks $OPTARG" | 70 | FORKS="--forks $OPTARG" |
71 | ;; | 71 | ;; |
72 | r) | 72 | r) |
73 | RERUN=1 | 73 | RERUN=1 |
74 | ;; | 74 | ;; |
75 | :) | 75 | :) |
76 | echo "Option -$OPTARG requires an argument." >&2 | 76 | echo "Option -$OPTARG requires an argument." >&2 |
77 | exit 1 | 77 | exit 1 |
78 | ;; | 78 | ;; |
79 | \?) | 79 | \?) |
80 | echo "BAD USAGE : unknow opton -$OPTARG" >&2 | 80 | echo "BAD USAGE : unknow opton -$OPTARG" >&2 |
81 | exit 1 | 81 | exit 1 |
82 | ;; | 82 | ;; |
83 | esac | 83 | esac |
84 | done | 84 | done |
85 | 85 | ||
86 | # mode debug enable | 86 | # mode debug enable |
87 | if [ $DEBUG -eq 1 ] | 87 | if [ $DEBUG -eq 1 ] |
88 | then | 88 | then |
89 | set -x | 89 | set -x |
90 | echo -e "## Mode DEBUG ON ##" | 90 | echo -e "## Mode DEBUG ON ##" |
91 | fi | 91 | fi |
92 | 92 | ||
93 | # mode verbose enable | 93 | # mode verbose enable |
94 | if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ;fi | 94 | if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ;fi |
95 | 95 | ||
96 | # Check USAGE by arguments number | 96 | # Check USAGE by arguments number |
97 | if [ $(($#-($OPTIND-1))) -ne 1 ] | 97 | if [ $(($#-($OPTIND-1))) -ne 1 ] |
98 | then | 98 | then |
99 | echo "BAD USAGE : SecondPass.sh [OPTIONS] <FIRST_PASS_DIR>" | 99 | echo "BAD USAGE : SecondPass.sh [OPTIONS] <FIRST_PASS_DIR>" |
100 | echo "$0 -h for more info" | 100 | echo "$0 -h for more info" |
101 | exit 1 | 101 | exit 1 |
102 | fi | 102 | fi |
103 | 103 | ||
104 | shift $((OPTIND-1)) | 104 | shift $((OPTIND-1)) |
105 | # check FirstPass directory - First argument | 105 | # check FirstPass directory - First argument |
106 | if [ -e $1 ] && [ -d $1 ] | 106 | if [ -e $1 ] && [ -d $1 ] |
107 | then | 107 | then |
108 | FIRSTPASS_DIR=$(readlink -e $1) | 108 | FIRSTPASS_DIR=$(readlink -e $1) |
109 | else | 109 | else |
110 | print_error "Can't find $1 directory" | 110 | print_error "Can't find $1 directory" |
111 | exit 1 | 111 | exit 1 |
112 | fi | 112 | fi |
113 | 113 | ||
114 | #-------------# | 114 | #-------------# |
115 | # GLOBAL VARS # | 115 | # GLOBAL VARS # |
116 | #-------------# | 116 | #-------------# |
117 | FIRSTPASS_CONFIG_FILE="$FIRSTPASS_DIR/FirstPass.cfg" | 117 | FIRSTPASS_CONFIG_FILE="$FIRSTPASS_DIR/FirstPass.cfg" |
118 | if [ -e $FIRSTPASS_CONFIG_FILE ] | 118 | if [ -e $FIRSTPASS_CONFIG_FILE ] |
119 | then | 119 | then |
120 | WAV_FILE=$(cat $FIRSTPASS_CONFIG_FILE | grep "WAV_FILE=" | cut -f2 -d"=") | 120 | WAV_FILE=$(cat $FIRSTPASS_CONFIG_FILE | grep "WAV_FILE=" | cut -f2 -d"=") |
121 | BASENAME=$(cat $FIRSTPASS_CONFIG_FILE | grep "^BASENAME=" | cut -f2 -d"=") | 121 | BASENAME=$(cat $FIRSTPASS_CONFIG_FILE | grep "^BASENAME=" | cut -f2 -d"=") |
122 | OUTPUT_DIR=$(cat $FIRSTPASS_CONFIG_FILE | grep "OUTPUT_DIR=" | cut -f2 -d"=") | 122 | OUTPUT_DIR=$(cat $FIRSTPASS_CONFIG_FILE | grep "OUTPUT_DIR=" | cut -f2 -d"=") |
123 | OUTPUT_DIR_BASENAME=$FIRSTPASS_DIR | 123 | OUTPUT_DIR_BASENAME=$FIRSTPASS_DIR |
124 | PLP_FILE_P1=$(cat $FIRSTPASS_CONFIG_FILE | grep "PLP_FILE=" | cut -f2 -d"=") | 124 | PLP_FILE_P1=$(cat $FIRSTPASS_CONFIG_FILE | grep "PLP_FILE=" | cut -f2 -d"=") |
125 | PLP_DIR_P1=$(cat $FIRSTPASS_CONFIG_FILE | grep "PLP_DIR=" | cut -f2 -d"=") | 125 | PLP_DIR_P1=$(cat $FIRSTPASS_CONFIG_FILE | grep "PLP_DIR=" | cut -f2 -d"=") |
126 | SEG_FILE_P1=$(cat $FIRSTPASS_CONFIG_FILE | grep "SEG_FILE=" | cut -f2 -d"=") | 126 | SEG_FILE_P1=$(cat $FIRSTPASS_CONFIG_FILE | grep "SEG_FILE=" | cut -f2 -d"=") |
127 | LBL_FILE_P1=$(cat $FIRSTPASS_CONFIG_FILE | grep "LBL_FILE=" | cut -f2 -d"=") | 127 | LBL_FILE_P1=$(cat $FIRSTPASS_CONFIG_FILE | grep "LBL_FILE=" | cut -f2 -d"=") |
128 | RES_DIR_P1=$(cat $FIRSTPASS_CONFIG_FILE | grep "RES_DIR=" | cut -f2 -d"=") | 128 | RES_DIR_P1=$(cat $FIRSTPASS_CONFIG_FILE | grep "RES_DIR=" | cut -f2 -d"=") |
129 | else | 129 | else |
130 | print_error "Can't find $FIRSTPASS_CONFIG_FILE file" | 130 | print_error "Can't find $FIRSTPASS_CONFIG_FILE file" |
131 | print_error "exit" | 131 | print_error "exit" |
132 | exit 1 | 132 | exit 1 |
133 | fi | 133 | fi |
134 | LST=$OUTPUT_DIR_BASENAME"/lists" | 134 | LST=$OUTPUT_DIR_BASENAME"/lists" |
135 | HMM=$OUTPUT_DIR_BASENAME"/hmm/" | 135 | HMM=$OUTPUT_DIR_BASENAME"/hmm/" |
136 | RES_DIR=$OUTPUT_DIR_BASENAME"/res_p2" | 136 | RES_DIR=$OUTPUT_DIR_BASENAME"/res_p2" |
137 | LOGFILE="$OUTPUT_DIR_BASENAME/info_p2.log" | 137 | LOGFILE="$OUTPUT_DIR_BASENAME/info_p2.log" |
138 | ERRORFILE="$OUTPUT_DIR_BASENAME/error_p2.log" | 138 | ERRORFILE="$OUTPUT_DIR_BASENAME/error_p2.log" |
139 | 139 | ||
140 | print_info "[${BASENAME}] => P2 start | $(date +'%d/%m/%y %H:%M:%S')" 1 | 140 | print_info "[${BASENAME}] => P2 start | $(date +'%d/%m/%y %H:%M:%S')" 1 |
141 | 141 | ||
142 | #------------------# | 142 | #------------------# |
143 | # Create WORKSPACE # | 143 | # Create WORKSPACE # |
144 | #------------------# | 144 | #------------------# |
145 | 145 | ||
146 | # Lock directory | 146 | # Lock directory |
147 | if [ -e $OUTPUT_DIR_BASENAME/SECONDPASS.lock ] && [ $RERUN -eq 0 ]; then print_warn "[${BASENAME}] SECONDPASS is locked -> exit" 2; exit 1;fi | 147 | if [ -e $OUTPUT_DIR_BASENAME/SECONDPASS.lock ] && [ $RERUN -eq 0 ]; then print_warn "[${BASENAME}] SECONDPASS is locked -> exit" 2; exit 1;fi |
148 | rm "$OUTPUT_DIR_BASENAME/SECONDPASS.unlock" > /dev/null 2>&1 | 148 | rm "$OUTPUT_DIR_BASENAME/SECONDPASS.unlock" > /dev/null 2>&1 |
149 | touch "$OUTPUT_DIR_BASENAME/SECONDPASS.lock" > /dev/null 2>&1 | 149 | touch "$OUTPUT_DIR_BASENAME/SECONDPASS.lock" > /dev/null 2>&1 |
150 | 150 | ||
151 | rm -r $LST > /dev/null 2>&1 | 151 | rm -r $LST > /dev/null 2>&1 |
152 | mkdir -p $LST | 152 | mkdir -p $LST |
153 | print_info "[${BASENAME}] Make directory $LST" 2 | 153 | print_info "[${BASENAME}] Make directory $LST" 2 |
154 | if [ $RERUN -eq 0 ]; then rm -r $HMM > /dev/null 2>&1; fi | 154 | if [ $RERUN -eq 0 ]; then rm -r $HMM > /dev/null 2>&1; fi |
155 | mkdir -p $HMM | 155 | mkdir -p $HMM |
156 | print_info "[${BASENAME}] Make directory $HMM" 2 | 156 | print_info "[${BASENAME}] Make directory $HMM" 2 |
157 | if [ $RERUN -eq 0 ]; then rm -r $RES_DIR > /dev/null 2>&1; fi | 157 | if [ $RERUN -eq 0 ]; then rm -r $RES_DIR > /dev/null 2>&1; fi |
158 | mkdir -p $RES_DIR > /dev/null 2>&1 | 158 | mkdir -p $RES_DIR > /dev/null 2>&1 |
159 | print_info "[${BASENAME}] Make directory $RES_DIR" 2 | 159 | print_info "[${BASENAME}] Make directory $RES_DIR" 2 |
160 | rm $LOGFILE $ERRORFILE > /dev/null 2>&1 | 160 | rm $LOGFILE $ERRORFILE > /dev/null 2>&1 |
161 | 161 | ||
162 | #-------------------# | 162 | #-------------------# |
163 | # Check Pass # | 163 | # Check Pass # |
164 | #-------------------# | 164 | #-------------------# |
165 | print_info "[${BASENAME}] Check Pass 2 directory" 1 | 165 | print_info "[${BASENAME}] Check Pass 2 directory" 1 |
166 | for treil in $(ls $RES_DIR/ | grep treil) | 166 | for treil in $(ls $RES_DIR/ | grep treil) |
167 | do | 167 | do |
168 | if [ ! -s $RES_DIR/$treil ] | 168 | if [ ! -s $RES_DIR/$treil ] |
169 | then | 169 | then |
170 | bn = $(basename $treil ".treil") | 170 | bn = $(basename $treil ".treil") |
171 | rm $RES_DIR/$treil $RES_DIR/$bn.seg $RES_DIR/$bn.res $RES_DIR/$bn.pho 2> /dev/null | 171 | rm $RES_DIR/$treil $RES_DIR/$bn.seg $RES_DIR/$bn.res $RES_DIR/$bn.pho 2> /dev/null |
172 | print_info "[${BASENAME}] $RES_DIR/$bn.* files deleted.." 2 | 172 | print_info "[${BASENAME}] $RES_DIR/$bn.* files deleted.." 2 |
173 | fi | 173 | fi |
174 | done | 174 | done |
175 | 175 | ||
176 | # Check if more then 89% of treil are done | 176 | # Check if more then 89% of treil are done |
177 | nbres_p1=$(ls $RES_DIR_P1/*.res 2> /dev/null | wc -l) | 177 | nbres_p1=$(ls $RES_DIR_P1/*.res 2> /dev/null | wc -l) |
178 | nbtreil_p2=$(ls $RES_DIR/*.treil 2> /dev/null | wc -l) | 178 | nbtreil_p2=$(ls $RES_DIR/*.treil 2> /dev/null | wc -l) |
179 | if [ $nbres_p1 -gt 0 ] | 179 | if [ $nbres_p1 -gt 0 ] |
180 | then | 180 | then |
181 | pourcentage=$((($nbtreil_p2*100)/$nbres_p1)) | 181 | pourcentage=$((($nbtreil_p2*100)/$nbres_p1)) |
182 | if [ $pourcentage -gt 89 ] | 182 | if [ $pourcentage -gt 89 ] |
183 | then | 183 | then |
184 | print_info "[${BASENAME}] Lattice already done, skipping $BASENAME" 1 | 184 | print_info "[${BASENAME}] Lattice already done, skipping $BASENAME" 1 |
185 | exit 0 | 185 | exit 0 |
186 | fi | 186 | fi |
187 | else | 187 | else |
188 | print_error "[${BASENAME}] No First Pass, No .res -> exit P2" | 188 | print_error "[${BASENAME}] No First Pass, No .res -> exit P2" |
189 | if [ $CHECK -eq 1 ]; then print_log_file $ERRORFILE "No First Pass, No .res -> exit P2" ;fi | 189 | if [ $CHECK -eq 1 ]; then print_log_file $ERRORFILE "No First Pass, No .res -> exit P2" ;fi |
190 | exit 1 | 190 | exit 1 |
191 | fi | 191 | fi |
192 | 192 | ||
193 | #--------------------# | 193 | #--------------------# |
194 | # Save configuration # | 194 | # Save configuration # |
195 | #--------------------# | 195 | #--------------------# |
196 | cp $SECONDPASS_CONFIG_FILE $OUTPUT_DIR_BASENAME/SecondPass.cfg | 196 | cp $SECONDPASS_CONFIG_FILE $OUTPUT_DIR_BASENAME/SecondPass.cfg |
197 | echo "WAV_FILE=$WAV_FILE" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg | 197 | echo "WAV_FILE=$WAV_FILE" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg |
198 | echo "BASENAME=$BASENAME" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg | 198 | echo "BASENAME=$BASENAME" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg |
199 | echo "FIRSTPASS_DIR=$FIRSTPASS_DIR" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg | 199 | echo "FIRSTPASS_DIR=$FIRSTPASS_DIR" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg |
200 | echo "PLP_DIR_P1=$PLP_DIR_P1" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg | 200 | echo "PLP_DIR_P1=$PLP_DIR_P1" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg |
201 | echo "PLP_FILE_P1=$PLP_FILE_P1" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg | ||
201 | echo "OUTPUT_DIR=$OUTPUT_DIR" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg | 202 | echo "OUTPUT_DIR=$OUTPUT_DIR" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg |
202 | echo "OUTPUT_DIR_BASENAME=$OUTPUT_DIR_BASENAME" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg | 203 | echo "OUTPUT_DIR_BASENAME=$OUTPUT_DIR_BASENAME" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg |
203 | echo "LST=$LST" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg | 204 | echo "LST=$LST" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg |
204 | echo "HMM=$HMM" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg | 205 | echo "HMM=$HMM" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg |
205 | echo "RES_DIR=$RES_DIR" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg | 206 | echo "RES_DIR=$RES_DIR" >> $OUTPUT_DIR_BASENAME/SecondPass.cfg |
206 | print_info "[${BASENAME}] Save config in $OUTPUT_DIR_BASENAME/SecondPass.cfg" 1 | 207 | print_info "[${BASENAME}] Save config in $OUTPUT_DIR_BASENAME/SecondPass.cfg" 1 |
207 | 208 | ||
208 | 209 | ||
209 | #--------------------------------------------------# | 210 | #--------------------------------------------------# |
210 | # Speaker Adaptation (AM) + Second pass (DECODING) # | 211 | # Speaker Adaptation (AM) + Second pass (DECODING) # |
211 | #--------------------------------------------------# | 212 | #--------------------------------------------------# |
212 | print_info "[${BASENAME}] Launch Second Pass" 1 | 213 | print_info "[${BASENAME}] Launch Second Pass" 1 |
213 | 214 | ||
214 | # for all speaker | 215 | # for all speaker |
215 | for speaker in $(cat $LBL_FILE_P1 | cut -f4 -d" " | sort | uniq) | 216 | for speaker in $(cat $LBL_FILE_P1 | cut -f4 -d" " | sort | uniq) |
216 | do | 217 | do |
217 | ## get seg file from P1 containing the speaker | 218 | ## get seg file from P1 containing the speaker |
218 | find $RES_DIR_P1 -name "*${speaker}.seg" -exec basename "{}" .seg \; | sort > $LST/$speaker.lst | 219 | find $RES_DIR_P1 -name "*${speaker}.seg" -exec basename "{}" .seg \; | sort > $LST/$speaker.lst |
219 | print_info "[${BASENAME}] file for $speaker in $LST/$speaker.lst" 3 | 220 | print_info "[${BASENAME}] file for $speaker in $LST/$speaker.lst" 3 |
220 | if [ ! -s $LST/$speaker.lst ]; then print_warn "no ${speaker} file in $RES_DIR_P1" 3; continue; fi | 221 | if [ ! -s $LST/$speaker.lst ]; then print_warn "no ${speaker} file in $RES_DIR_P1" 3; continue; fi |
221 | 222 | ||
222 | 223 | ||
223 | # for all AM | 224 | # for all AM |
224 | for (( i=0; $i<${#MTAG[@]} ; i++ )) | 225 | for (( i=0; $i<${#MTAG[@]} ; i++ )) |
225 | do | 226 | do |
226 | if [ -e $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst ]; then | 227 | if [ -e $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst ]; then |
227 | type=$(grep -e "${speaker}$" "$OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst") | 228 | type=$(grep -e "${speaker}$" "$OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst") |
228 | ## if is the good AM for the speaker | 229 | ## if is the good AM for the speaker |
229 | if [ -n "$type" ] | 230 | if [ -n "$type" ] |
230 | then | 231 | then |
231 | ## HMM adaptation | 232 | ## HMM adaptation |
232 | if [ $RERUN -eq 0 ] || ( [ ! -e $HMM/$speaker.hmm ] || [ -z $HMM/$speaker.hmm ] ) | 233 | if [ $RERUN -eq 0 ] || ( [ ! -e $HMM/$speaker.hmm ] || [ -z $HMM/$speaker.hmm ] ) |
233 | then | 234 | then |
234 | 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 | 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 |
235 | $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/ 2> /dev/null | 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/ 2> /dev/null |
236 | fi | 237 | fi |
237 | 238 | ||
238 | if [ $CHECK -eq 1 ] && ( [ ! -e $HMM/$speaker.hmm ] || [ -z $HMM/$speaker.hmm ] ) | 239 | if [ $CHECK -eq 1 ] && ( [ ! -e $HMM/$speaker.hmm ] || [ -z $HMM/$speaker.hmm ] ) |
239 | then | 240 | then |
240 | print_warn "[${BASENAME}] No hmm files created for $speaker" 2 | 241 | print_warn "[${BASENAME}] No hmm files created for $speaker" 2 |
241 | print_log_file $ERRORFILE "ERROR [$(date +'%d/%m/%y %H:%M:%S')] No hmm files created for $speaker" | 242 | print_log_file $ERRORFILE "ERROR [$(date +'%d/%m/%y %H:%M:%S')] No hmm files created for $speaker" |
242 | print_error "[${BASENAME}] Check $ERRORFILE" | 243 | print_error "[${BASENAME}] Check $ERRORFILE" |
243 | #exit 1 | 244 | #exit 1 |
244 | fi | 245 | fi |
245 | 246 | ||
246 | ## cp map files | 247 | ## cp map files |
247 | cp $SPEERAL_AM/${MODS[$i]}.map $HMM/$speaker.map | 248 | cp $SPEERAL_AM/${MODS[$i]}.map $HMM/$speaker.map |
248 | 249 | ||
249 | ## class clustering | 250 | ## class clustering |
250 | if [ -s $HMM/$speaker.hmm ] && ( [ $RERUN -eq 0 ] || ( [ ! -e $HMM/$speaker.cls ] || [ -z $HMM/$speaker.cls ] )) | 251 | if [ -s $HMM/$speaker.hmm ] && ( [ $RERUN -eq 0 ] || ( [ ! -e $HMM/$speaker.cls ] || [ -z $HMM/$speaker.cls ] )) |
251 | then | 252 | then |
252 | print_info "[${BASENAME}] $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 |
253 | $SPEERAL_TOOLS/gclust_pdf $HMM/$speaker.hmm $HMM/$speaker.cls -i $SPEERAL_AM/${MODS[$i]}.cls 2> /dev/null | 254 | $SPEERAL_TOOLS/gclust_pdf $HMM/$speaker.hmm $HMM/$speaker.cls -i $SPEERAL_AM/${MODS[$i]}.cls 2> /dev/null |
254 | fi | 255 | fi |
255 | if [ $CHECK -eq 1 ] && ( [ ! -e $HMM/$speaker.cls ] || [ -z $HMM/$speaker.cls ] ) | 256 | if [ $CHECK -eq 1 ] && ( [ ! -e $HMM/$speaker.cls ] || [ -z $HMM/$speaker.cls ] ) |
256 | then | 257 | then |
257 | print_warn "[${BASENAME}] No cls file created for $speaker" 2 | 258 | print_warn "[${BASENAME}] No cls file created for $speaker" 2 |
258 | print_log_file $ERRORFILE "ERROR [$(date +'%d/%m/%y %H:%M:%S')] No cls file created for $speakers" | 259 | print_log_file $ERRORFILE "ERROR [$(date +'%d/%m/%y %H:%M:%S')] No cls file created for $speakers" |
259 | print_error "[${BASENAME}] Check $ERRORFILE" | 260 | print_error "[${BASENAME}] Check $ERRORFILE" |
260 | #exit 1 | 261 | #exit 1 |
261 | fi | 262 | fi |
262 | 263 | ||
263 | ## Speeral decoding | 264 | ## Speeral decoding |
264 | if [ -s $HMM/$speaker.hmm ] && [ -s $HMM/$speaker.cls ] | 265 | if [ -s $HMM/$speaker.hmm ] && [ -s $HMM/$speaker.cls ] |
265 | then | 266 | then |
266 | 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" 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" 3 |
267 | $SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_CFG[$i]} -r $PLP_DIR_P1 -m $HMM/$speaker.hmm -c $HMM/$speaker.cls $FORKS --lock | 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 |
268 | else | 269 | else |
269 | print_warn "[${BASENAME}] $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 |
270 | 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" 3 | 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" 3 |
271 | $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 | 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 |
272 | fi | 273 | fi |
273 | 274 | ||
274 | if [ $CHECK -eq 1 ] | 275 | if [ $CHECK -eq 1 ] |
275 | then | 276 | then |
276 | check_second_pass_output_speeral "$LST/$speaker.lst" "$RES_DIR" | 277 | check_second_pass_output_speeral "$LST/$speaker.lst" "$RES_DIR" |
277 | if [ $? -eq 1 ] | 278 | if [ $? -eq 1 ] |
278 | then | 279 | then |
279 | print_warn "[${BASENAME}] Speeral output error : check $LOGFILE" 2 | 280 | print_warn "[${BASENAME}] Speeral output error : check $LOGFILE" 2 |
280 | print_log_file $LOGFILE "WARN : Speeral number of output ERROR $LST/$speaker.lst" | 281 | print_log_file $LOGFILE "WARN : Speeral number of output ERROR $LST/$speaker.lst" |
281 | ls $RES_DIR/*.seg | grep -e "$speaker" | sed -e "s|$RES_DIR\/||" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp | 282 | ls $RES_DIR/*.seg | grep -e "$speaker" | sed -e "s|$RES_DIR\/||" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp |
282 | print_log_file $LOGFILE "Segs (and treil) not done :\n[" | 283 | print_log_file $LOGFILE "Segs (and treil) not done :\n[" |
283 | diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE | 284 | diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE |
284 | print_log_file $LOGFILE "] [$(date +'%d/%m/%y %H:%M:%S')]" | 285 | print_log_file $LOGFILE "] [$(date +'%d/%m/%y %H:%M:%S')]" |
285 | rm ${OUTPUT_DIR_BASENAME}/.tmp | 286 | rm ${OUTPUT_DIR_BASENAME}/.tmp |
286 | #exit 1 | 287 | #exit 1 |
287 | fi | 288 | fi |
288 | fi | 289 | fi |
289 | break | 290 | break |
290 | fi | 291 | fi |
291 | fi | 292 | fi |
292 | done | 293 | done |
293 | #rm "$HMM/$speaker.*" > /dev/null 2>&1 | 294 | #rm "$HMM/$speaker.*" > /dev/null 2>&1 |
294 | #rm "$LST/$speaker.lst" > /dev/null 2>&1 | 295 | #rm "$LST/$speaker.lst" > /dev/null 2>&1 |
295 | done | 296 | done |
296 | 297 | ||
297 | ## Check missing seg and log it | 298 | ## Check missing seg and log it |
298 | if [ $CHECK -eq 1 ] | 299 | if [ $CHECK -eq 1 ] |
299 | then | 300 | then |
300 | ls $RES_DIR/*.treil | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.treil//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp | 301 | ls $RES_DIR/*.treil | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.treil//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp |
301 | todo=$(cat ${PLP_FILE_P1} | wc -l) | 302 | todo=$(cat ${PLP_FILE_P1} | wc -l) |
302 | if [ $todo -eq 0 ]; then todo=1;fi | 303 | if [ $todo -eq 0 ]; then todo=1;fi |
303 | notdone=$(($todo - $(cat ${OUTPUT_DIR_BASENAME}/.tmp | wc -l))) | 304 | notdone=$(($todo - $(cat ${OUTPUT_DIR_BASENAME}/.tmp | wc -l))) |
304 | pourcentage=$((($notdone*100)/$todo)) | 305 | pourcentage=$((($notdone*100)/$todo)) |
305 | if [ $notdone -ne 0 ] | 306 | if [ $notdone -ne 0 ] |
306 | then | 307 | then |
307 | print_error "[${BASENAME}] Check $ERRORFILE" | 308 | print_error "[${BASENAME}] Check $ERRORFILE" |
308 | print_log_file "$ERRORFILE" "ERROR : Treil not done [" | 309 | print_log_file "$ERRORFILE" "ERROR : Treil not done [" |
309 | diff ${PLP_FILE_P1} ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $ERRORFILE | 310 | diff ${PLP_FILE_P1} ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $ERRORFILE |
310 | print_log_file "$ERRORFILE" "] $pourcentage% $BASENAME" | 311 | print_log_file "$ERRORFILE" "] $pourcentage% $BASENAME" |
311 | else | 312 | else |
312 | print_log_file "$LOGFILE" "P2 OK $BASENAME | $(date +'%d/%m/%y %H:%M:%S')" | 313 | print_log_file "$LOGFILE" "P2 OK $BASENAME | $(date +'%d/%m/%y %H:%M:%S')" |
313 | fi | 314 | fi |
314 | rm ${OUTPUT_DIR_BASENAME}/.tmp > /dev/null 2>&1 | 315 | rm ${OUTPUT_DIR_BASENAME}/.tmp > /dev/null 2>&1 |
315 | fi | 316 | fi |
316 | 317 | ||
317 | #---------------# | 318 | #---------------# |
318 | # Convert res # | 319 | # Convert res # |
319 | #---------------# | 320 | #---------------# |
320 | 321 | ||
321 | print_info "[${BASENAME}] Convert .res into .ctm" 1 | 322 | print_info "[${BASENAME}] Convert .res into .ctm" 1 |
322 | # .res => .ctm | 323 | # .res => .ctm |
323 | $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format CTM --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.2pass.ctm | 324 | $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format CTM --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.2pass.ctm |
324 | print_info "[${BASENAME}] Convert .res into .trs" 1 | 325 | print_info "[${BASENAME}] Convert .res into .trs" 1 |
325 | # .res => .trs | 326 | # .res => .trs |
326 | echo -e "name $AUTHOR\nfileName ${BASENAME}\nfileExt wav\nsegFile ${OUTPUT_DIR_BASENAME}/${BASENAME}.seg" > ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg | 327 | echo -e "name $AUTHOR\nfileName ${BASENAME}\nfileExt wav\nsegFile ${OUTPUT_DIR_BASENAME}/${BASENAME}.seg" > ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg |
327 | $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 | 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 |
328 | rm ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg > /dev/null 2>&1 | 329 | rm ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg > /dev/null 2>&1 |
329 | print_info "[${BASENAME}] Convert .res into .txt" 1 | 330 | print_info "[${BASENAME}] Convert .res into .txt" 1 |
330 | # .res => .txt | 331 | # .res => .txt |
331 | $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TXT --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.2pass.txt | 332 | $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TXT --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.2pass.txt |
332 | 333 | ||
333 | print_info "[${BASENAME}] <= P2 End | $(date +'%d/%m/%y %H:%M:%S')" 1 | 334 | print_info "[${BASENAME}] <= P2 End | $(date +'%d/%m/%y %H:%M:%S')" 1 |
334 | # unlock directory | 335 | # unlock directory |
335 | mv "$OUTPUT_DIR_BASENAME/SECONDPASS.lock" "$OUTPUT_DIR_BASENAME/SECONDPASS.unlock" | 336 | mv "$OUTPUT_DIR_BASENAME/SECONDPASS.lock" "$OUTPUT_DIR_BASENAME/SECONDPASS.unlock" |
336 | 337 | ||
337 | 338 |
main_tools/ThirdPass.sh
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | ##################################################### | 3 | ##################################################### |
4 | # File : ThirdPass.sh # | 4 | # File : ThirdPass.sh # |
5 | # Brief : ASR third pass using trigg files # | 5 | # Brief : ASR third pass using trigg files # |
6 | # Author : Jean-François Rey # | 6 | # Author : Jean-François Rey # |
7 | # Version : 1.0 # | 7 | # Version : 1.0 # |
8 | # Date : 18/07/13 # | 8 | # Date : 18/07/13 # |
9 | ##################################################### | 9 | ##################################################### |
10 | 10 | ||
11 | echo "### ThirdPass.sh ###" | 11 | echo "### ThirdPass.sh ###" |
12 | 12 | ||
13 | # Check OTMEDIA_HOME env var | 13 | # Check OTMEDIA_HOME env var |
14 | if [ -z ${OTMEDIA_HOME} ] | 14 | if [ -z ${OTMEDIA_HOME} ] |
15 | then | 15 | then |
16 | OTMEDIA_HOME=$(dirname $(dirname $(readlink -e $0))) | 16 | OTMEDIA_HOME=$(dirname $(dirname $(readlink -e $0))) |
17 | export OTMEDIA_HOME=$OTMEDIA_HOME | 17 | export OTMEDIA_HOME=$OTMEDIA_HOME |
18 | fi | 18 | fi |
19 | 19 | ||
20 | # where is SecondPass.sh | 20 | # where is SecondPass.sh |
21 | MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0)) | 21 | MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0)) |
22 | 22 | ||
23 | # Scripts Path | 23 | # Scripts Path |
24 | SCRIPT_PATH=$OTMEDIA_HOME/tools/scripts | 24 | SCRIPT_PATH=$OTMEDIA_HOME/tools/scripts |
25 | 25 | ||
26 | # Include scripts | 26 | # Include scripts |
27 | . $SCRIPT_PATH"/Tools.sh" | 27 | . $SCRIPT_PATH"/Tools.sh" |
28 | . $SCRIPT_PATH"/CheckThirdPass.sh" | 28 | . $SCRIPT_PATH"/CheckThirdPass.sh" |
29 | 29 | ||
30 | # where is ThirdPass.cfg | 30 | # where is ThirdPass.cfg |
31 | THIRDPASS_CONFIG_FILE=$OTMEDIA_HOME"/cfg/ThirdPass.cfg" | 31 | THIRDPASS_CONFIG_FILE=$OTMEDIA_HOME"/cfg/ThirdPass.cfg" |
32 | if [ -e $THIRDPASS_CONFIG_FILE ] | 32 | if [ -e $THIRDPASS_CONFIG_FILE ] |
33 | then | 33 | then |
34 | . $THIRDPASS_CONFIG_FILE | 34 | . $THIRDPASS_CONFIG_FILE |
35 | else | 35 | else |
36 | echo "ERROR : Can't find configuration file $THIRDPASS_CONFIG_FILE" >&2 | 36 | echo "ERROR : Can't find configuration file $THIRDPASS_CONFIG_FILE" >&2 |
37 | exit 1 | 37 | exit 1 |
38 | fi | 38 | fi |
39 | 39 | ||
40 | #---------------# | 40 | #---------------# |
41 | # Parse Options # | 41 | # Parse Options # |
42 | #---------------# | 42 | #---------------# |
43 | while getopts ":hDv:crf:" opt | 43 | while getopts ":hDv:crf:" opt |
44 | do | 44 | do |
45 | case $opt in | 45 | case $opt in |
46 | h) | 46 | h) |
47 | echo -e "$0 [OPTIONS] <PASS_DIRECTORY>\n" | 47 | echo -e "$0 [OPTIONS] <PASS_DIRECTORY>\n" |
48 | echo -e "\t Options:" | 48 | echo -e "\t Options:" |
49 | echo -e "\t\t-h :\tprint this message" | 49 | echo -e "\t\t-h :\tprint this message" |
50 | echo -e "\t\t-D :\tDEBUG mode on" | 50 | echo -e "\t\t-D :\tDEBUG mode on" |
51 | echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode" | 51 | echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode" |
52 | echo -e "\t\t-c :\t Check process, stop if error detected" | 52 | echo -e "\t\t-c :\t Check process, stop if error detected" |
53 | echo -e "\t\t-f n :\tSpecify speeral forks number (default 1)" | 53 | echo -e "\t\t-f n :\tSpecify speeral forks number (default 1)" |
54 | echo -e "\t\t-r n :\tforce rerun the show, without deleting works already done" | 54 | echo -e "\t\t-r n :\tforce rerun the show, without deleting works already done" |
55 | exit 1 | 55 | exit 1 |
56 | ;; | 56 | ;; |
57 | D) | 57 | D) |
58 | DEBUG=1 | 58 | DEBUG=1 |
59 | ;; | 59 | ;; |
60 | v) | 60 | v) |
61 | VERBOSE=$OPTARG | 61 | VERBOSE=$OPTARG |
62 | ;; | 62 | ;; |
63 | c) | 63 | c) |
64 | CHECK=1 | 64 | CHECK=1 |
65 | ;; | 65 | ;; |
66 | f) | 66 | f) |
67 | FORKS="--forks $OPTARG" | 67 | FORKS="--forks $OPTARG" |
68 | ;; | 68 | ;; |
69 | r) | 69 | r) |
70 | RERUN=1 | 70 | RERUN=1 |
71 | ;; | 71 | ;; |
72 | :) | 72 | :) |
73 | echo "Option -$OPTARG requires an argument." >&2 | 73 | echo "Option -$OPTARG requires an argument." >&2 |
74 | exit 1 | 74 | exit 1 |
75 | ;; | 75 | ;; |
76 | \?) | 76 | \?) |
77 | echo "BAD USAGE : unknow opton -$OPTARG" | 77 | echo "BAD USAGE : unknow opton -$OPTARG" |
78 | #exit 1 | 78 | #exit 1 |
79 | ;; | 79 | ;; |
80 | esac | 80 | esac |
81 | done | 81 | done |
82 | 82 | ||
83 | # mode debug enable | 83 | # mode debug enable |
84 | if [ $DEBUG -eq 1 ] | 84 | if [ $DEBUG -eq 1 ] |
85 | then | 85 | then |
86 | set -x | 86 | set -x |
87 | echo -e "## Mode DEBUG ON ##" | 87 | echo -e "## Mode DEBUG ON ##" |
88 | fi | 88 | fi |
89 | 89 | ||
90 | # mode verbose enable | 90 | # mode verbose enable |
91 | if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ; fi | 91 | if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ; fi |
92 | 92 | ||
93 | # Check USAGE by arguments number | 93 | # Check USAGE by arguments number |
94 | if [ $(($#-($OPTIND-1))) -ne 1 ] | 94 | if [ $(($#-($OPTIND-1))) -ne 1 ] |
95 | then | 95 | then |
96 | echo "BAD USAGE : ThirdPass.sh [OPTIONS] <PASS_DIR>" | 96 | echo "BAD USAGE : ThirdPass.sh [OPTIONS] <PASS_DIR>" |
97 | echo "$0 -h for more info" | 97 | echo "$0 -h for more info" |
98 | exit 1 | 98 | exit 1 |
99 | fi | 99 | fi |
100 | 100 | ||
101 | shift $((OPTIND-1)) | 101 | shift $((OPTIND-1)) |
102 | # check Pass directory - First argument | 102 | # check Pass directory - First argument |
103 | if [ -e $1 ] && [ -d $1 ] | 103 | if [ -e $1 ] && [ -d $1 ] |
104 | then | 104 | then |
105 | PASS_DIR=$(readlink -e $1) | 105 | PASS_DIR=$(readlink -e $1) |
106 | BASENAME=$(basename $PASS_DIR) | 106 | BASENAME=$(basename $PASS_DIR) |
107 | else | 107 | else |
108 | print_error "can't find $1 directory" | 108 | print_error "can't find $1 directory" |
109 | exit 1 | 109 | exit 1 |
110 | fi | 110 | fi |
111 | 111 | ||
112 | print_info "[${BASENAME}] => P3 start | $(date +'%d/%m/%y %H:%M:%S')" 1 | 112 | print_info "[${BASENAME}] => P3 start | $(date +'%d/%m/%y %H:%M:%S')" 1 |
113 | 113 | ||
114 | #-------------# | 114 | #-------------# |
115 | # GLOBAL VARS # | 115 | # GLOBAL VARS # |
116 | #-------------# | 116 | #-------------# |
117 | EXPLOITCONFPASS_CONFIG_FILE="$PASS_DIR/ExploitConfPass.cfg" | 117 | EXPLOITCONFPASS_CONFIG_FILE="$PASS_DIR/ExploitConfPass.cfg" |
118 | if [ -e $EXPLOITCONFPASS_CONFIG_FILE ] | 118 | if [ -e $EXPLOITCONFPASS_CONFIG_FILE ] |
119 | then | 119 | then |
120 | TRIGGER_SPEERAL=$(cat $EXPLOITCONFPASS_CONFIG_FILE | grep "TRIGGER_SPEERAL=" | cut -f2 -d"=") | 120 | TRIGGER_SPEERAL=$(cat $EXPLOITCONFPASS_CONFIG_FILE | grep "TRIGGER_SPEERAL=" | cut -f2 -d"=") |
121 | LEX_SPEERAL=$(cat $EXPLOITCONFPASS_CONFIG_FILE | grep "LEX_SPEERAL=" | cut -f2 -d"=") | 121 | LEX_SPEERAL=$(cat $EXPLOITCONFPASS_CONFIG_FILE | grep "LEX_SPEERAL=" | cut -f2 -d"=") |
122 | LEX_BINODE_SPEERAL=$(cat $EXPLOITCONFPASS_CONFIG_FILE | grep "LEX_BINODE_SPEERAL=" | cut -f2 -d"=") | 122 | LEX_BINODE_SPEERAL=$(cat $EXPLOITCONFPASS_CONFIG_FILE | grep "LEX_BINODE_SPEERAL=" | cut -f2 -d"=") |
123 | LST="" | 123 | LST="" |
124 | PLP_DIR_P1="" | 124 | PLP_DIR_P1="" |
125 | HMM="" | 125 | HMM="" |
126 | else | 126 | else |
127 | print_error "[${BASENAME}] Can't find $EXPLOITCONFPASS_CONFIG_FILE file" | 127 | print_error "[${BASENAME}] Can't find $EXPLOITCONFPASS_CONFIG_FILE file" |
128 | print_warn "[${BASENAME}] Will use default directories and files" 2 | 128 | print_warn "[${BASENAME}] Will use default directories and files" 2 |
129 | #exit 1 | 129 | #exit 1 |
130 | TRIGGER_SPEERAL=$PASS_DIR/trigg/speeral/ | 130 | TRIGGER_SPEERAL=$PASS_DIR/trigg/speeral/ |
131 | LEX_SPEERAL=$PASS_DIR/LEX/speeral/LEXIQUE_V6_ext | 131 | LEX_SPEERAL=$PASS_DIR/LEX/speeral/LEXIQUE_V6_ext |
132 | LEX_BINODE_SPEERAL=$PASS_DIR/LEX/speeral/LEXIQUE_V6_ext.bin | 132 | LEX_BINODE_SPEERAL=$PASS_DIR/LEX/speeral/LEXIQUE_V6_ext.bin |
133 | fi | 133 | fi |
134 | 134 | ||
135 | SECONDPASS_CONFIG_FILE="$PASS_DIR/SecondPass.cfg" | 135 | SECONDPASS_CONFIG_FILE="$PASS_DIR/SecondPass.cfg" |
136 | if [ -e $SECONDPASS_CONFIG_FILE ] | 136 | if [ -e $SECONDPASS_CONFIG_FILE ] |
137 | then | 137 | then |
138 | LST=$(cat $SECONDPASS_CONFIG_FILE | grep "^LST=" | cut -f2 -d"=") | 138 | LST=$(cat $SECONDPASS_CONFIG_FILE | grep "^LST=" | cut -f2 -d"=") |
139 | HMM=$(cat $SECONDPASS_CONFIG_FILE | grep "^HMM=" | cut -f2 -d"=") | 139 | HMM=$(cat $SECONDPASS_CONFIG_FILE | grep "^HMM=" | cut -f2 -d"=") |
140 | PLP_DIR_P1=$(cat $SECONDPASS_CONFIG_FILE | grep "^PLP_DIR_P1=" | cut -f2 -d"=") | 140 | PLP_DIR_P1=$(cat $SECONDPASS_CONFIG_FILE | grep "^PLP_DIR_P1=" | cut -f2 -d"=") |
141 | PLP_FILE_P1=$(cat $SECONDPASS_CONFIG_FILE | grep "^PLP_FILE_P1=" | cut -f2 -d"=") | 141 | PLP_FILE_P1=$(cat $SECONDPASS_CONFIG_FILE | grep "^PLP_FILE_P1=" | cut -f2 -d"=") |
142 | else | 142 | else |
143 | print_error "[${BASENAME}] Can't find $SECONDPASS_CONFIG_FILE file" | 143 | print_error "[${BASENAME}] Can't find $SECONDPASS_CONFIG_FILE file" |
144 | print_warn "[${BASENAME}] Will use default directories and files" 2 | 144 | print_warn "[${BASENAME}] Will use default directories and files" 2 |
145 | #exit 1 | 145 | #exit 1 |
146 | LST=$PASS_DIR/lists | 146 | LST=$PASS_DIR/lists |
147 | HMM=$PASS_DIR/hmm | 147 | HMM=$PASS_DIR/hmm |
148 | PLP_DIR_P1=$PASS_DIR/PLP | 148 | PLP_DIR_P1=$PASS_DIR/PLP |
149 | PLP_FILE_P1=$PASS_DIR/plp.lst | 149 | PLP_FILE_P1=$PASS_DIR/plp.lst |
150 | fi | 150 | fi |
151 | 151 | ||
152 | OUTPUT_DIR_BASENAME=$PASS_DIR | 152 | OUTPUT_DIR_BASENAME=$PASS_DIR |
153 | RES_DIR="$PASS_DIR/res_p3" | 153 | RES_DIR="$PASS_DIR/res_p3" |
154 | LOGFILE=$PASS_DIR"/info_p3.log" | 154 | LOGFILE=$PASS_DIR"/info_p3.log" |
155 | ERRORFILE=$PASS_DIR"/error_p3.log" | 155 | ERRORFILE=$PASS_DIR"/error_p3.log" |
156 | 156 | ||
157 | #------------------# | 157 | #------------------# |
158 | # Create WORKSPACE # | 158 | # Create WORKSPACE # |
159 | #------------------# | 159 | #------------------# |
160 | 160 | ||
161 | # Lock directory | 161 | # Lock directory |
162 | if [ -e $OUTPUT_DIR_BASENAME/THIRDPASS.lock ] && [ $RERUN -eq 0 ]; then print_warn "[${BASENAME}] THIRDPASS is locked -> exit" 2; exit 1; fi | 162 | if [ -e $OUTPUT_DIR_BASENAME/THIRDPASS.lock ] && [ $RERUN -eq 0 ]; then print_warn "[${BASENAME}] THIRDPASS is locked -> exit" 2; exit 1; fi |
163 | rm "$OUTPUT_DIR_BASENAME/THIRDPASS.unlock" > /dev/null 2>&1 | 163 | rm "$OUTPUT_DIR_BASENAME/THIRDPASS.unlock" > /dev/null 2>&1 |
164 | touch "$OUTPUT_DIR_BASENAME/THIRDPASS.lock" > /dev/null 2>&1 | 164 | touch "$OUTPUT_DIR_BASENAME/THIRDPASS.lock" > /dev/null 2>&1 |
165 | 165 | ||
166 | if [ $RERUN -eq 0 ]; then rm -r $RES_DIR > /dev/null 2>&1; fi | 166 | if [ $RERUN -eq 0 ]; then rm -r $RES_DIR > /dev/null 2>&1; fi |
167 | mkdir -p $RES_DIR | 167 | mkdir -p $RES_DIR |
168 | print_info "[${BASENAME}] Make directory $RES_DIR" 3 | 168 | print_info "[${BASENAME}] Make directory $RES_DIR" 3 |
169 | 169 | ||
170 | #--------------------# | 170 | #--------------------# |
171 | # Save configuration # | 171 | # Save configuration # |
172 | #--------------------# | 172 | #--------------------# |
173 | cp $THIRDPASS_CONFIG_FILE $OUTPUT_DIR_BASENAME/ThirdPass.cfg | 173 | cp $THIRDPASS_CONFIG_FILE $OUTPUT_DIR_BASENAME/ThirdPass.cfg |
174 | echo "RES_DIR=$RES_DIR" >> $OUTPUT_DIR_BASENAME/ThirdPass.cfg | 174 | echo "RES_DIR=$RES_DIR" >> $OUTPUT_DIR_BASENAME/ThirdPass.cfg |
175 | print_info "[${BASENAME}] Save config in $OUTPUT_DIR_BASENAME/ThirdPass.cfg" 1 | 175 | print_info "[${BASENAME}] Save config in $OUTPUT_DIR_BASENAME/ThirdPass.cfg" 1 |
176 | 176 | ||
177 | #--------------------------------------------------# | 177 | #--------------------------------------------------# |
178 | # Third Pass using trigger file (DECODING) # | 178 | # Third Pass using trigger file (DECODING) # |
179 | #--------------------------------------------------# | 179 | #--------------------------------------------------# |
180 | print_info "[${BASENAME}] Launch Third Pass" 1 | 180 | print_info "[${BASENAME}] Launch Third Pass" 1 |
181 | 181 | ||
182 | ## Generate speeral config file adding trigger rep | 182 | ## Generate speeral config file adding trigger rep |
183 | cat $SPEERAL_CFG_PATH/$SPEERAL_CFG_FILE | sed -e "s|<nom>[^<]*</nom>|<nom>$OUTPUT_DIR_BASENAME/LEX/speeral/LEXIQUE_V6_ext</nom>|g" \ | 183 | cat $SPEERAL_CFG_PATH/$SPEERAL_CFG_FILE | sed -e "s|<nom>[^<]*</nom>|<nom>$OUTPUT_DIR_BASENAME/LEX/speeral/LEXIQUE_V6_ext</nom>|g" \ |
184 | | sed -e "s|<binode>[^<]*</binode>|<binode>$OUTPUT_DIR_BASENAME/LEX/speeral/LEXIQUE_V6_ext.bin</binode>|g" \ | 184 | | sed -e "s|<binode>[^<]*</binode>|<binode>$OUTPUT_DIR_BASENAME/LEX/speeral/LEXIQUE_V6_ext.bin</binode>|g" \ |
185 | | sed -e "s|<trigger><dir>[^<]*</dir></trigger>|<trigger><dir>$TRIGGER_SPEERAL</dir></trigger>|g" > $OUTPUT_DIR_BASENAME/SpeeralThirdPass.xml | 185 | | sed -e "s|<trigger><dir>[^<]*</dir></trigger>|<trigger><dir>$TRIGGER_SPEERAL</dir></trigger>|g" > $OUTPUT_DIR_BASENAME/SpeeralThirdPass.xml |
186 | SPEERAL_THIRD_CFG=$OUTPUT_DIR_BASENAME/SpeeralThirdPass.xml | 186 | SPEERAL_THIRD_CFG=$OUTPUT_DIR_BASENAME/SpeeralThirdPass.xml |
187 | print_info "[${BASENAME}] Third Pass Speeral Config file ${SPEERAL_THIRD_CFG}" 3 | 187 | print_info "[${BASENAME}] Third Pass Speeral Config file ${SPEERAL_THIRD_CFG}" 3 |
188 | 188 | ||
189 | # for all speaker | 189 | # for all speaker |
190 | for lspeaker in $(ls $LST/*.lst) | 190 | for lspeaker in $(ls $LST/*.lst) |
191 | do | 191 | do |
192 | speaker=$(basename $lspeaker ".lst") | 192 | speaker=$(basename $lspeaker ".lst") |
193 | # for all AM | 193 | # for all AM |
194 | for (( i=0; $i<${#MTAG[@]} ; i++ )) | 194 | for (( i=0; $i<${#MTAG[@]} ; i++ )) |
195 | do | 195 | do |
196 | if [ -e $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst ]; then | 196 | if [ -e $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst ]; then |
197 | type=$(grep -e "${speaker}$" "$OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst") | 197 | type=$(grep -e "${speaker}$" "$OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst") |
198 | ## if is the good AM for the speaker | 198 | ## if is the good AM for the speaker |
199 | if [ -n "$type" ] | 199 | if [ -n "$type" ] |
200 | then | 200 | then |
201 | ## Speeral decoding | 201 | ## Speeral decoding |
202 | if [ -s $HMM/$speaker.hmm ] && [ -s $HMM/$speaker.cls ] | 202 | if [ -s $HMM/$speaker.hmm ] && [ -s $HMM/$speaker.cls ] |
203 | then | 203 | then |
204 | print_info "[${BASENAME}] $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 | 204 | print_info "[${BASENAME}] $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 |
205 | $SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_THIRD_CFG} -r $PLP_DIR_P1 -m $HMM/$speaker.hmm -c $HMM/$speaker.cls $FORKS --lock | 205 | $SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_THIRD_CFG} -r $PLP_DIR_P1 -m $HMM/$speaker.hmm -c $HMM/$speaker.cls $FORKS --lock |
206 | else | 206 | else |
207 | print_warn "[${BASENAME}] $HMM/$speaker.hmm and $speaker.cls empty, do default decoding..." 2 | 207 | print_warn "[${BASENAME}] $HMM/$speaker.hmm and $speaker.cls empty, do default decoding..." 2 |
208 | print_info "$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" 3 | 208 | print_info "$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" 3 |
209 | $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 | 209 | $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 |
210 | fi | 210 | fi |
211 | 211 | ||
212 | if [ $CHECK -eq 1 ] | 212 | if [ $CHECK -eq 1 ] |
213 | then | 213 | then |
214 | check_third_pass_output_speeral "$LST/$speaker.lst" "$RES_DIR" | 214 | check_third_pass_output_speeral "$LST/$speaker.lst" "$RES_DIR" |
215 | if [ $? -eq 1 ] | 215 | if [ $? -eq 1 ] |
216 | then | 216 | then |
217 | 217 | ||
218 | print_warn "[${BASENAME}] Speeral output error : check $LOGFILE" 2 | 218 | print_warn "[${BASENAME}] Speeral output error : check $LOGFILE" 2 |
219 | print_log_file $LOGFILE "WARN : Speeral number of output ERROR $LST/$speaker.lst" | 219 | print_log_file $LOGFILE "WARN : Speeral number of output ERROR $LST/$speaker.lst" |
220 | ls $RES_DIR/*.seg 2>/dev/null | grep -e "$speaker" | sed -e "s|$RES_DIR\/||" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp | 220 | ls $RES_DIR/*.seg 2>/dev/null | grep -e "$speaker" | sed -e "s|$RES_DIR\/||" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp |
221 | print_log_file $LOGFILE "Segs (and treil) not done :\n[" | 221 | print_log_file $LOGFILE "Segs (and treil) not done :\n[" |
222 | diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE | 222 | diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE |
223 | print_log_file $LOGFILE "] [$(date +'%d/%m/%y %H:%M:%S')]" | 223 | print_log_file $LOGFILE "] [$(date +'%d/%m/%y %H:%M:%S')]" |
224 | rm ${OUTPUT_DIR_BASENAME}/.tmp | 224 | rm ${OUTPUT_DIR_BASENAME}/.tmp |
225 | fi | 225 | fi |
226 | fi | 226 | fi |
227 | break | 227 | break |
228 | fi | 228 | fi |
229 | fi | 229 | fi |
230 | done | 230 | done |
231 | done | 231 | done |
232 | 232 | ||
233 | ## Check missing seg and log it | 233 | ## Check missing seg and log it |
234 | 234 | ||
235 | ## Check missing seg and log it | 235 | ## Check missing seg and log it |
236 | if [ $CHECK -eq 1 ] | 236 | if [ $CHECK -eq 1 ] |
237 | then | 237 | then |
238 | ls $RES_DIR/*.treil 2>/deV/null | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.treil//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp | 238 | ls $RES_DIR/*.treil 2>/deV/null | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.treil//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp |
239 | todo=$(cat ${PLP_FILE_P1} | wc -l) | 239 | todo=$(cat ${PLP_FILE_P1} 2>/dev/null | wc -l) |
240 | if [ $todo -eq 0 ]; then todo=1;fi | 240 | if [ $todo -eq 0 ]; then todo=1;fi |
241 | notdone=$(($todo - $(cat ${OUTPUT_DIR_BASENAME}/.tmp | wc -l))) | 241 | notdone=$(($todo - $(cat ${OUTPUT_DIR_BASENAME}/.tmp | wc -l))) |
242 | pourcentage=$((($notdone*100)/$todo)) | 242 | pourcentage=$((($notdone*100)/$todo)) |
243 | if [ $notdone -ne 0 ] | 243 | if [ $notdone -ne 0 ] |
244 | then | 244 | then |
245 | print_error "[${BASENAME}] Check $ERRORFILE" | 245 | print_error "[${BASENAME}] Check $ERRORFILE" |
246 | print_log_file "$ERRORFILE" "ERROR : Treil not done [" | 246 | print_log_file "$ERRORFILE" "ERROR : Treil not done [" |
247 | diff ${PLP_FILE_P1} ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $ERRORFILE | 247 | diff ${PLP_FILE_P1} ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $ERRORFILE |
248 | print_log_file "$ERRORFILE" "] $pourcentage% $BASENAME" | 248 | print_log_file "$ERRORFILE" "] $pourcentage% $BASENAME" |
249 | else | 249 | else |
250 | print_log_file "$LOGFILE" "P3 OK $BASENAME | $(date +'%d/%m/%y %H:%M:%S')" | 250 | print_log_file "$LOGFILE" "P3 OK $BASENAME | $(date +'%d/%m/%y %H:%M:%S')" |
251 | fi | 251 | fi |
252 | rm ${OUTPUT_DIR_BASENAME}/.tmp > /dev/null 2>&1 | 252 | rm ${OUTPUT_DIR_BASENAME}/.tmp > /dev/null 2>&1 |
253 | fi | 253 | fi |
254 | 254 | ||
255 | #---------------# | 255 | #---------------# |
256 | # Convert res # | 256 | # Convert res # |
257 | #---------------# | 257 | #---------------# |
258 | 258 | ||
259 | print_info "[${BASENAME}] Convert .res into .ctm" 1 | 259 | print_info "[${BASENAME}] Convert .res into .ctm" 1 |
260 | # .res => .ctm | 260 | # .res => .ctm |
261 | $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format CTM --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.ctm | 261 | $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format CTM --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.ctm |
262 | print_info "[${BASENAME}] Convert .res into .trs" 1 | 262 | print_info "[${BASENAME}] Convert .res into .trs" 1 |
263 | # .res => .trs | 263 | # .res => .trs |
264 | echo -e "name $AUTHOR\nfileName ${BASENAME}\nfileExt wav\nsegFile ${OUTPUT_DIR_BASENAME}/${BASENAME}.seg" > ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg | 264 | echo -e "name $AUTHOR\nfileName ${BASENAME}\nfileExt wav\nsegFile ${OUTPUT_DIR_BASENAME}/${BASENAME}.seg" > ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg |
265 | $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 | 265 | $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 |
266 | rm ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg > /dev/null 2>&1 | 266 | rm ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg > /dev/null 2>&1 |
267 | print_info "[${BASENAME}] Convert .res into .txt" 1 | 267 | print_info "[${BASENAME}] Convert .res into .txt" 1 |
268 | # .res => .txt | 268 | # .res => .txt |
269 | $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TXT --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.txt | 269 | $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TXT --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.txt |
270 | 270 | ||
271 | 271 | ||
272 | print_info "[${BASENAME}] <= P3 End | $(date +'%d/%m/%y %H:%M:%S')" 1 | 272 | print_info "[${BASENAME}] <= P3 End | $(date +'%d/%m/%y %H:%M:%S')" 1 |
273 | 273 | ||
274 | # unlock directory | 274 | # unlock directory |
275 | mv "$OUTPUT_DIR_BASENAME/THIRDPASS.lock" "$OUTPUT_DIR_BASENAME/THIRDPASS.unlock" | 275 | mv "$OUTPUT_DIR_BASENAME/THIRDPASS.lock" "$OUTPUT_DIR_BASENAME/THIRDPASS.unlock" |
276 | 276 | ||
277 | 277 |