Commit 1c85f8188a84120bd52201d81b2129e78ce13051
1 parent
4188f35cd8
Exists in
master
update Checktools
Showing 4 changed files with 9 additions and 9 deletions Inline Diff
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 | 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 | 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} | 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 |
tools/scripts/CheckFirstPass.sh
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | ################################################# | 3 | ################################################# |
4 | # File : CheckFirstPass.sh # | 4 | # File : CheckFirstPass.sh # |
5 | # Brief : Check First Pass # | 5 | # Brief : Check First Pass # |
6 | # Author : Jean-François Rey # | 6 | # Author : Jean-François Rey # |
7 | # Version : 1.0 # | 7 | # Version : 1.0 # |
8 | # Date : 13/06/13 # | 8 | # Date : 13/06/13 # |
9 | ################################################# | 9 | ################################################# |
10 | 10 | ||
11 | # configuration file | 11 | # configuration file |
12 | . "$OTMEDIA_HOME/cfg/FirstPass.cfg" | 12 | . "$OTMEDIA_HOME/cfg/FirstPass.cfg" |
13 | 13 | ||
14 | # check_first_pass_plp(filenamefullpath) | 14 | # check_first_pass_plp(filenamefullpath) |
15 | # - filenamefullpath : full path to plp file | 15 | # - filenamefullpath : full path to plp file |
16 | # return 0 if ok, otherwise return 1 | 16 | # return 0 if ok, otherwise return 1 |
17 | function check_first_pass_plp() | 17 | function check_first_pass_plp() |
18 | { | 18 | { |
19 | if [ $# -eq 1 ] | 19 | if [ $# -eq 1 ] |
20 | then | 20 | then |
21 | if [ ! -e "$1" ] || [ -z "$1" ]; then return 1; fi | 21 | if [ ! -e "$1" ] || [ -z "$1" ]; then return 1; fi |
22 | LINESNB=$($BIN_PATH/aff_mat$ARCH "$1" | wc -l) | 22 | LINESNB=$($BIN_PATH/aff_mat$ARCH "$1" | wc -l) |
23 | if [ $LINESNB -lt 350000 ] | 23 | if [ $LINESNB -lt 350000 ] |
24 | then | 24 | then |
25 | return 1 | 25 | return 1 |
26 | fi | 26 | fi |
27 | fi | 27 | fi |
28 | return 0 | 28 | return 0 |
29 | } | 29 | } |
30 | 30 | ||
31 | # check_first_pass_plps_lbl(plppath,lblfile) | 31 | # check_first_pass_plps_lbl(plppath,lblfile) |
32 | # - plppath : path to plp files | 32 | # - plppath : path to plp files |
33 | # - lblfile : a lblfile | 33 | # - lblfile : a lblfile |
34 | # return 0 if plp files nb == nb files contain in lbl , 1 otherwise | 34 | # return 0 if plp files nb == nb files contain in lbl , 1 otherwise |
35 | function check_first_pass_plps_lbl() | 35 | function check_first_pass_plps_lbl() |
36 | { | 36 | { |
37 | if [ $# -eq 2 ] | 37 | if [ $# -eq 2 ] |
38 | then | 38 | then |
39 | if [ ! -e "$1" ] || [ -z "$1" ]; then return 1; fi | 39 | if [ ! -e "$1" ] || [ -z "$1" ]; then return 1; fi |
40 | if [ ! -e "$2" ] || [ -z "$2" ]; then return 1; fi | 40 | if [ ! -e "$2" ] || [ -z "$2" ]; then return 1; fi |
41 | FILENBLBL=$(cat "$2" | wc -l) | 41 | FILENBLBL=$(cat "$2" | wc -l) |
42 | FILENBPLP=$(ls "$1" | wc -l) | 42 | FILENBPLP=$(ls "$1" 2>/dev/null | wc -l) |
43 | if [ $FILENBLBL -ne $FILENBPLP ]; then return 1; fi | 43 | if [ $FILENBLBL -ne $FILENBPLP ]; then return 1; fi |
44 | fi | 44 | fi |
45 | return 0 | 45 | return 0 |
46 | } | 46 | } |
47 | 47 | ||
48 | 48 | ||
49 | #check_first_pass_output_speeral(plplist,resdir) | 49 | #check_first_pass_output_speeral(plplist,resdir) |
50 | # - plplist : filename containing plp list | 50 | # - plplist : filename containing plp list |
51 | # - resdir : output Speeral directory | 51 | # - resdir : output Speeral directory |
52 | check_first_pass_output_speeral() | 52 | check_first_pass_output_speeral() |
53 | { | 53 | { |
54 | if [ $# -eq 2 ] | 54 | if [ $# -eq 2 ] |
55 | then | 55 | then |
56 | if [ ! -e "$1" ] || [ -z "$1" ]; then return 1; fi | 56 | if [ ! -e "$1" ] || [ -z "$1" ]; then return 1; fi |
57 | FILENBSEG=$(ls $2/*.seg | grep -f "$1" | wc -l) | 57 | FILENBSEG=$(ls $2/*.seg 2>/dev/null | grep -f "$1" | wc -l) |
58 | FILENBRES=$(ls $2/*.res | grep -f "$1" | wc -l) | 58 | FILENBRES=$(ls $2/*.res 2>/dev/null | grep -f "$1" | wc -l) |
59 | #FILENBPHO=$(ls "$2/*.pho" | grep -f "$1" | wc -l) | 59 | #FILENBPHO=$(ls "$2/*.pho" | grep -f "$1" | wc -l) |
60 | FILENB=$(cat "$1" | wc -l) | 60 | FILENB=$(cat "$1" | wc -l) |
61 | FILENBPHO=$FILENB | 61 | FILENBPHO=$FILENB |
62 | if [ $FILENB -ne $FILENBSEG ] || [ $FILENB -ne $FILENBRES ] || [ $FILENB -ne $FILENBPHO ] ; then return 1;fi | 62 | if [ $FILENB -ne $FILENBSEG ] || [ $FILENB -ne $FILENBRES ] || [ $FILENB -ne $FILENBPHO ] ; then return 1;fi |
63 | fi | 63 | fi |
64 | return 0 | 64 | return 0 |
65 | } | 65 | } |
66 | 66 | ||
67 | 67 |
tools/scripts/CheckSecondPass.sh
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | ################################################# | 3 | ################################################# |
4 | # File : CheckSecondPass.sh # | 4 | # File : CheckSecondPass.sh # |
5 | # Brief : Check Second Pass # | 5 | # Brief : Check Second Pass # |
6 | # Author : Jean-François Rey # | 6 | # Author : Jean-François Rey # |
7 | # Version : 1.0 # | 7 | # Version : 1.0 # |
8 | # Date : 17/06/13 # | 8 | # Date : 17/06/13 # |
9 | ################################################# | 9 | ################################################# |
10 | 10 | ||
11 | # configuration file | 11 | # configuration file |
12 | . "$OTMEDIA_HOME/cfg/SecondPass.cfg" | 12 | . "$OTMEDIA_HOME/cfg/SecondPass.cfg" |
13 | 13 | ||
14 | 14 | ||
15 | #check_second_pass_output_speeral(plplist,resdir) | 15 | #check_second_pass_output_speeral(plplist,resdir) |
16 | # - plplist : filename containing plp list | 16 | # - plplist : filename containing plp list |
17 | # - resdir : output Speeral directory | 17 | # - resdir : output Speeral directory |
18 | function check_second_pass_output_speeral() | 18 | function check_second_pass_output_speeral() |
19 | { | 19 | { |
20 | if [ $# -eq 2 ] | 20 | if [ $# -eq 2 ] |
21 | then | 21 | then |
22 | if [ ! -e "$1" ] || [ -z "$1" ]; then return 1; fi | 22 | if [ ! -e "$1" ] || [ -z "$1" ]; then return 1; fi |
23 | FILENBSEG=$(ls "$2/*.seg" 2> /dev/null | grep -f "$1" | wc -l) | 23 | FILENBSEG=$(ls "$2/*.seg" 2> /dev/null | grep -f "$1" | wc -l) |
24 | FILENBRES=$(ls "$2/*.res" 2> /dev/null | grep -f "$1" | wc -l) | 24 | FILENBRES=$(ls "$2/*.res" 2> /dev/null | grep -f "$1" | wc -l) |
25 | FILENBTREIL=$(ls "$2/*.treil" 2 /dev/null | grep -f "$1" | wc -l) | 25 | FILENBTREIL=$(ls "$2/*.treil" 2> /dev/null | grep -f "$1" | wc -l) |
26 | FILENB=$(cat "$1" | wc -l) | 26 | FILENB=$(cat "$1" | wc -l) |
27 | if [ $FILENB -ne $FILENBSEG ] || [ $FILENB -ne $FILENBRES ] || [ $FILENB -ne $FILENBTREIL ] ; then return 1;fi | 27 | if [ $FILENB -ne $FILENBSEG ] || [ $FILENB -ne $FILENBRES ] || [ $FILENB -ne $FILENBTREIL ] ; then return 1;fi |
28 | fi | 28 | fi |
29 | return 0 | 29 | return 0 |
30 | } | 30 | } |
31 | 31 | ||
32 | 32 |
tools/scripts/CheckThirdPass.sh
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | ################################################# | 3 | ################################################# |
4 | # File : CheckThirdPass.sh # | 4 | # File : CheckThirdPass.sh # |
5 | # Brief : Check Second Pass # | 5 | # Brief : Check Second Pass # |
6 | # Author : Jean-François Rey # | 6 | # Author : Jean-François Rey # |
7 | # Version : 1.0 # | 7 | # Version : 1.0 # |
8 | # Date : 25/06/13 # | 8 | # Date : 25/06/13 # |
9 | ################################################# | 9 | ################################################# |
10 | 10 | ||
11 | # configuration file | 11 | # configuration file |
12 | . "$OTMEDIA_HOME/cfg/ThirdPass.cfg" | 12 | . "$OTMEDIA_HOME/cfg/ThirdPass.cfg" |
13 | 13 | ||
14 | 14 | ||
15 | #check_third_pass_output_speeral(plplist,resdir) | 15 | #check_third_pass_output_speeral(plplist,resdir) |
16 | # - plplist : filename containing plp list | 16 | # - plplist : filename containing plp list |
17 | # - resdir : output Speeral directory | 17 | # - resdir : output Speeral directory |
18 | function check_third_pass_output_speeral() | 18 | function check_third_pass_output_speeral() |
19 | { | 19 | { |
20 | if [ $# -eq 2 ] | 20 | if [ $# -eq 2 ] |
21 | then | 21 | then |
22 | if [ ! -e "$1" ] || [ -z "$1" ]; then return 1; fi | 22 | if [ ! -e "$1" ] || [ -z "$1" ]; then return 1; fi |
23 | FILENBSEG=$(ls "$2/*.seg" | grep -f "$1" | wc -l) | 23 | FILENBSEG=$(ls "$2/*.seg" 2>/dev/null | grep -f "$1" | wc -l) |
24 | FILENBRES=$(ls "$2/*.res" | grep -f "$1" | wc -l) | 24 | FILENBRES=$(ls "$2/*.res" 2>/dev/null | grep -f "$1" | wc -l) |
25 | FILENBTREIL=$(ls "$2/*.treil" | grep -f "$1" | wc -l) | 25 | FILENBTREIL=$(ls "$2/*.treil" 2>/deV/null | grep -f "$1" | wc -l) |
26 | FILENB=$(cat "$1" | wc -l) | 26 | FILENB=$(cat "$1" | wc -l) |
27 | if [ $FILENB -ne $FILENBSEG ] || [ $FILENB -ne $FILENBRES ] || [ $FILENB -ne $FILENBTREIL ] ; then return 1;fi | 27 | if [ $FILENB -ne $FILENBSEG ] || [ $FILENB -ne $FILENBRES ] || [ $FILENB -ne $FILENBTREIL ] ; then return 1;fi |
28 | fi | 28 | fi |
29 | return 0 | 29 | return 0 |
30 | } | 30 | } |
31 | 31 | ||
32 | 32 |