Commit 0bf609bcceb3af008651888fa40b72c381245e37

Authored by Jean-François Rey
1 parent 87013ba29c
Exists in master

update and add script to extract TV corpus

Showing 6 changed files with 24 additions and 17 deletions Inline Diff

1 #-------------------# 1 #-------------------#
2 # OTMEDIA README # 2 # OTMEDIA README #
3 # version 1.0 # 3 # version 1.0 #
4 #-------------------# 4 #-------------------#
5 5
6 "Observatoire Transmedia pour l'étude des évolutions et transformations du monde médiatique"
6 7
7 OTMEDIA_HOME 8 OTMEDIA_HOME
8 install.sh 9 install.sh
9 10
10 Modif a la main de fichier si on veut 11 Modif a la main de fichier si on veut
11 12
12 install solr + tomcat 13 install solr + tomcat
13 14
14 15
15 16
1 -Check and add Verbose messages 1 - Check and add Verbose messages
2 - Modifiy SOLR request
2 3
main_tools/ConfPass.sh
1 #!/bin/bash 1 #!/bin/bash
2 2
3 ##################################################### 3 #####################################################
4 # File : ConfPass.sh # 4 # File : ConfPass.sh #
5 # Brief : Process the ASR Confidence pass # 5 # Brief : Process the ASR Confidence 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.0 # 9 # Version : 1.0 #
10 # Date : 17/06/13 # 10 # Date : 17/06/13 #
11 ##################################################### 11 #####################################################
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 20
21 # where is ConfPath.sh 21 # where is ConfPath.sh
22 MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0)) 22 MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0))
23 23
24 # Scripts Path 24 # Scripts Path
25 SCRIPT_PATH=$OTMEDIA_HOME/tools/scripts 25 SCRIPT_PATH=$OTMEDIA_HOME/tools/scripts
26 26
27 # Include scripts 27 # Include scripts
28 . $SCRIPT_PATH"/Tools.sh" 28 . $SCRIPT_PATH"/Tools.sh"
29 . $SCRIPT_PATH"/CheckConfPass.sh" 29 . $SCRIPT_PATH"/CheckConfPass.sh"
30 30
31 # where is FirstPass.cfg 31 # where is FirstPass.cfg
32 CONFPASS_CONFIG_FILE="$OTMEDIA_HOME/cfg/ConfPass.cfg" 32 CONFPASS_CONFIG_FILE="$OTMEDIA_HOME/cfg/ConfPass.cfg"
33 if [ -e $CONFPASS_CONFIG_FILE ] 33 if [ -e $CONFPASS_CONFIG_FILE ]
34 then 34 then
35 . $CONFPASS_CONFIG_FILE 35 . $CONFPASS_CONFIG_FILE
36 else 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" >&2
38 exit 1 38 exit 1
39 fi 39 fi
40 40
41 #---------------# 41 #---------------#
42 # Parse Options # 42 # Parse Options #
43 #---------------# 43 #---------------#
44 while getopts ":hDv:cr" opt 44 while getopts ":hDv:cr" opt
45 do 45 do
46 case $opt in 46 case $opt in
47 h) 47 h)
48 echo -e "$0 [OPTIONS] <INPUT_DIRECTORY> <TREIL_DIRECTORY_NAME>\n" 48 echo -e "$0 [OPTIONS] <INPUT_DIRECTORY> <TREIL_DIRECTORY_NAME>\n"
49 echo -e "\t Options:" 49 echo -e "\t Options:"
50 echo -e "\t\t-h :\tprint this message" 50 echo -e "\t\t-h :\tprint this message"
51 echo -e "\t\t-D :\tDEBUG mode on" 51 echo -e "\t\t-D :\tDEBUG mode on"
52 echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode" 52 echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode"
53 echo -e "\t\t-c :\t Check process, stop if error detected" 53 echo -e "\t\t-c :\t Check process, stop if error detected"
54 echo -e "\t\t-r :\tForce to rerun confpas without deleting existing files" 54 echo -e "\t\t-r :\tForce to rerun confpas without deleting existing files"
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 r) 66 r)
67 RERUN=1 67 RERUN=1
68 ;; 68 ;;
69 :) 69 :)
70 echo "Option -$OPTARG requires an argument." >&2 70 echo "Option -$OPTARG requires an argument." >&2
71 exit 1 71 exit 1
72 ;; 72 ;;
73 \?) 73 \?)
74 echo "BAD USAGE : unknow opton -$OPTARG" 74 echo "BAD USAGE : unknow opton -$OPTARG"
75 #exit 1 75 #exit 1
76 ;; 76 ;;
77 esac 77 esac
78 done 78 done
79 79
80 # mode debug enable 80 # mode debug enable
81 if [ $DEBUG -eq 1 ] 81 if [ $DEBUG -eq 1 ]
82 then 82 then
83 set -x 83 set -x
84 echo -e "## Mode DEBUG ON ##" 84 echo -e "## Mode DEBUG ON ##"
85 fi 85 fi
86 86
87 # mode verbose enable 87 # mode verbose enable
88 if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ; fi 88 if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ; fi
89 89
90 # Check USAGE by arguments number 90 # Check USAGE by arguments number
91 if [ $(($#-($OPTIND-1))) -ne 2 ] 91 if [ $(($#-($OPTIND-1))) -ne 2 ]
92 then 92 then
93 echo "BAD USAGE : ConfPass.sh [OPTIONS] <INPUT_DIR> <TREIL_DIRECTORY_NAME>" 93 echo "BAD USAGE : ConfPass.sh [OPTIONS] <INPUT_DIR> <TREIL_DIRECTORY_NAME>"
94 echo "$0 -h for more info" 94 echo "$0 -h for more info"
95 exit 1 95 exit 1
96 fi 96 fi
97 97
98 shift $((OPTIND-1)) 98 shift $((OPTIND-1))
99 # check input directory - first argument 99 # check input directory - first argument
100 if [ ! -e $1 ] 100 if [ ! -e $1 ]
101 then 101 then
102 print_error "can't open $1" 102 print_error "can't open $1"
103 exit 1 103 exit 1
104 fi 104 fi
105 # check treil input directory - second argument 105 # check treil input directory - second argument
106 if [ ! -e $1/$2 ] 106 if [ ! -e $1/$2 ]
107 then 107 then
108 print_error "can't open $1/$2" 108 print_error "can't open $1/$2"
109 exit 1 109 exit 1
110 fi 110 fi
111 111
112 #-------------# 112 #-------------#
113 # GLOBAL VARS # 113 # GLOBAL VARS #
114 #-------------# 114 #-------------#
115 INPUT_DIR=$(readlink -e $1) 115 INPUT_DIR=$(readlink -e $1)
116 OUTPUT_DIR=$INPUT_DIR 116 OUTPUT_DIR=$INPUT_DIR
117 BASENAME=$(basename $OUTPUT_DIR) 117 BASENAME=$(basename $OUTPUT_DIR)
118 RES_NAME=$2 118 RES_NAME=$2
119 RES_P="${INPUT_DIR}/${RES_NAME}" 119 RES_P="${INPUT_DIR}/${RES_NAME}"
120 USF_FILE=${INPUT_DIR}/${BASENAME}.${RES_NAME}.usf 120 USF_FILE=${INPUT_DIR}/${BASENAME}.${RES_NAME}.usf
121 CONF_DIR="$OUTPUT_DIR/conf/$RES_NAME" 121 CONF_DIR="$OUTPUT_DIR/conf/$RES_NAME"
122 RES_CONF_DIR="$OUTPUT_DIR/conf/$RES_NAME/scored_ctm" 122 RES_CONF_DIR="$OUTPUT_DIR/conf/$RES_NAME/scored_ctm"
123 LOGFILE="$(dirname $OUTPUT_DIR)/info_conf.log" 123 LOGFILE="$(dirname $OUTPUT_DIR)/info_conf.log"
124 ERRORFILE="$(dirname $OUTPUT_DIR)/error_conf.log" 124 ERRORFILE="$(dirname $OUTPUT_DIR)/error_conf.log"
125 125
126 126
127 #------------------# 127 #------------------#
128 # Create Workspace # 128 # Create Workspace #
129 #------------------# 129 #------------------#
130 # Lock directory 130 # Lock directory
131 if [ -e "$OUTPUT_DIR/CONFPASS.lock" ] && [ $RERUN -eq 0 ] 131 if [ -e "$OUTPUT_DIR/CONFPASS.lock" ] && [ $RERUN -eq 0 ]
132 then 132 then
133 print_info "Confpass lock $INPUT_DIR -> exit" 1 133 print_info "Confpass lock $INPUT_DIR -> exit" 1
134 exit 1 134 exit 1
135 fi 135 fi
136 rm "$OUTPUT_DIR/CONFPASS.unlock" > /dev/null 2>&1 136 rm "$OUTPUT_DIR/CONFPASS.unlock" > /dev/null 2>&1
137 touch "$OUTPUT_DIR/CONFPASS.lock" > /dev/null 2>&1 137 touch "$OUTPUT_DIR/CONFPASS.lock" > /dev/null 2>&1
138 if [ $RERUN -eq 0 ]; then rm -r $CONF_DIR > /dev/null 2>&1; fi 138 if [ $RERUN -eq 0 ]; then rm -r $CONF_DIR > /dev/null 2>&1; fi
139 if [ $RERUN -eq 1 ]; then rm $USF_FILE > /dev/null 2>&1; fi 139 if [ $RERUN -eq 1 ]; then rm $USF_FILE > /dev/null 2>&1; fi
140 mkdir -p $CONF_DIR 140 mkdir -p $CONF_DIR
141 mkdir -p $RES_CONF_DIR 141 mkdir -p $RES_CONF_DIR
142 142
143 #---------------# 143 #---------------#
144 # Check Pass # 144 # Check Pass #
145 #---------------# 145 #---------------#
146 146
147 # if usf contains more than 40% of 0.600 confidence -> usf error 147 # if usf contains more than 40% of 0.600 confidence -> usf error
148 if [ -s $USF_FILE ] 148 if [ -s $USF_FILE ]
149 then 149 then
150 conftozerosix=$(grep -c -E 'confidence="0.600"' "${USF_FILE}") 150 conftozerosix=$(grep -c -E 'confidence="0.600"' "${USF_FILE}")
151 conftoother=$(grep -c -v -E 'confidence="0.600"' "${USF_FILE}") 151 conftoother=$(grep -c -v -E 'confidence="0.600"' "${USF_FILE}")
152 if [ $conftoother -gt 0 ] 152 if [ $conftoother -gt 0 ]
153 then 153 then
154 pourcentageofzerosix=$((($conftozerosix*100)/$conftoother)) 154 pourcentageofzerosix=$((($conftozerosix*100)/$conftoother))
155 if [ $pourcentageofzerosix -gt 40 ] 155 if [ $pourcentageofzerosix -gt 40 ]
156 then 156 then
157 print_warn "${USF_FILE} got $pourcentageofzerosix% of 0.6 confidence" 1 157 print_warn "${USF_FILE} got $pourcentageofzerosix% of 0.6 confidence" 1
158 mv "${USF_FILE}" "${USF_FILE}.back" 158 mv "${USF_FILE}" "${USF_FILE}.back"
159 rm -r $CONF_DIR > /dev/null 2>&1 159 rm -r $CONF_DIR > /dev/null 2>&1
160 else 160 else
161 print_warn "${USF_FILE} already done, skipping it" 1 161 print_warn "${USF_FILE} already done, skipping it" 1
162 exit 0 162 exit 0
163 fi 163 fi
164 fi 164 fi
165 fi 165 fi
166 166
167 #------# 167 #------#
168 # Save # 168 # Save #
169 #------# 169 #------#
170 cp $CONFPASS_CONFIG_FILE $OUTPUT_DIR/ConfPass.cfg 170 cp $CONFPASS_CONFIG_FILE $OUTPUT_DIR/ConfPass.cfg
171 echo "RES_CONF_DIR=$RES_CONF_DIR" >> $OUTPUT_DIR/ConfPass.cfg 171 echo "RES_CONF_DIR=$RES_CONF_DIR" >> $OUTPUT_DIR/ConfPass.cfg
172 echo "CONF_DIR=$CONF_DIR" >> $OUTPUT_DIR/ConfPass.cfg 172 echo "CONF_DIR=$CONF_DIR" >> $OUTPUT_DIR/ConfPass.cfg
173 173
174 #--------------------# 174 #--------------------#
175 # CONFIDENCE MEASURE # 175 # CONFIDENCE MEASURE #
176 #--------------------# 176 #--------------------#
177 177
178 # Check pourcentage of scored_ctm already done, if < 85% done confidence measure 178 # Check pourcentage of scored_ctm already done, if < 85% done confidence measure
179 nbres_p=$(ls ${RES_P}/*.treil | wc -l) 179 nbres_p=$(ls ${RES_P}/*.treil | wc -l)
180 nbconf=$(ls ${RES_CONF_DIR}/*.res | wc -l) 180 nbconf=$(ls ${RES_CONF_DIR}/*.res | wc -l)
181 if [ $nbres_p -gt 0 ] 181 if [ $nbres_p -gt 0 ]
182 then 182 then
183 pourcentageres=$((($nbconf*100)/$nbres_p)) 183 pourcentageres=$((($nbconf*100)/$nbres_p))
184 if [ $pourcentageres -lt 85 ] 184 if [ $pourcentageres -lt 85 ]
185 then 185 then
186 print_info "Calcul Confidence $INPUT_DIR $RES_NAME" 1 186 print_info "Calcul Confidence $INPUT_DIR $RES_NAME" 1
187 $MAIN_SCRIPT_PATH/ConfidenceMeasure.sh $INPUT_DIR $RES_NAME 187 $MAIN_SCRIPT_PATH/ConfidenceMeasure.sh $INPUT_DIR $RES_NAME
188 else 188 else
189 print_info "skipping Confidence Calcul $INPUT_DIR/$RES_NAME" 1 189 print_info "skipping Confidence Calcul $INPUT_DIR/$RES_NAME" 1
190 fi 190 fi
191 fi 191 fi
192 192
193 ### Check scored_ctm number res files ! 193 ### Check scored_ctm number res files !
194 if [ $CHECK -eq 1 ] 194 if [ $CHECK -eq 1 ]
195 then 195 then
196 nbconf=$(ls ${RES_CONF_DIR}/*.res | wc -l) 196 nbconf=$(ls ${RES_CONF_DIR}/*.res | wc -l)
197 if [ $nbres_p -ne $nbconf ];then echo "WARN : ConfPass $INPUT_DIR/$RES_NAME number of res files differ" >> $LOGFILE;fi 197 if [ $nbres_p -ne $nbconf ];then echo "WARN : ConfPass $INPUT_DIR/$RES_NAME number of res files differ" >> $LOGFILE;fi
198 fi 198 fi
199 199
200 #---------------------------# 200 #---------------------------#
201 # FROM RES WITH CONF => USF # 201 # FROM RES WITH CONF => USF #
202 #---------------------------# 202 #---------------------------#
203 for f in `ls ${RES_CONF_DIR}`; do $SCRIPT_PATH/formatRES.pl $RES_CONF_DIR/$f; done 203 for f in `ls ${RES_CONF_DIR}`; do $SCRIPT_PATH/formatRES.pl $RES_CONF_DIR/$f; done
204 # create USF configuration file 204 # create USF configuration file
205 echo -e "name $AUTHOR\nfileName $BASENAME\nfileExt wav\nsegFile $OUTPUT_DIR/$BASENAME.seg" > $OUTPUT_DIR/$BASENAME.usf_cfg 205 echo -e "name $AUTHOR\nfileName $BASENAME\nfileExt wav\nsegFile $OUTPUT_DIR/$BASENAME.seg" > $OUTPUT_DIR/$BASENAME.usf_cfg
206 # create USF file 206 # create USF file
207 $SCRIPT_PATH/res2out.pl --dir $RES_CONF_DIR --format USF --ignore $RULES/asupp --out $USF_FILE --usf_config $OUTPUT_DIR/$BASENAME.usf_cfg 207 $SCRIPT_PATH/res2out.pl --dir $RES_CONF_DIR --format USF --ignore $RULES/asupp --out $USF_FILE.tmp --usf_config $OUTPUT_DIR/$BASENAME.usf_cfg
208 rm $OUTPUT_DIR/$BASENAME.usf_cfg 208 rm $OUTPUT_DIR/$BASENAME.usf_cfg
209 cat $USF_FILE.tmp | $SCRIPT_PATH/BdlexUC.pl $RULES/basic -f > $USF_FILE
209 cp $USF_FILE ${OUTPUT_DIR}/${BASENAME}.usf 210 cp $USF_FILE ${OUTPUT_DIR}/${BASENAME}.usf
211 rm $USF_FILE.tmp
210 212
211 #----------------# 213 #----------------#
212 # Check USF file # 214 # Check USF file #
213 #----------------# 215 #----------------#
214 if [ $CHECK -eq 1 ] 216 if [ $CHECK -eq 1 ]
215 then 217 then
216 check_conf_pass_usf "$OUTPUT_DIR/$BASENAME.usf" 218 check_conf_pass_usf "$OUTPUT_DIR/$BASENAME.usf"
217 if [ $? -eq 1 ] 219 if [ $? -eq 1 ]
218 then 220 then
219 echo -e "ERROR : Wrong confidence measures in USF file : $OUTPUT_DIR/$BASENAME.usf" >> $ERRORFILE 221 echo -e "ERROR : Wrong confidence measures in USF file : $OUTPUT_DIR/$BASENAME.usf" >> $ERRORFILE
220 exit 1 222 exit 1
221 fi 223 fi
222 fi 224 fi
223 225
224 #-------# 226 #-------#
225 # CLOSE # 227 # CLOSE #
226 #-------# 228 #-------#
227 # Seem OK 229 # Seem OK
228 print_info "<= End $BASENAME ConfPass | $(date +'%d/%m/%y %H:%M:%S')" 1 230 print_info "<= End $BASENAME ConfPass | $(date +'%d/%m/%y %H:%M:%S')" 1
229 echo -e "ConfPass $BASENAME OK" >> $LOGFILE 231 echo -e "ConfPass $BASENAME OK" >> $LOGFILE
230 232
231 # unlock directory 233 # unlock directory
232 mv "$OUTPUT_DIR/CONFPASS.lock" "$OUTPUT_DIR/CONFPASS.unlock" 234 mv "$OUTPUT_DIR/CONFPASS.lock" "$OUTPUT_DIR/CONFPASS.unlock"
233 235
234 236
main_tools/FirstPass.sh
1 #!/bin/bash 1 #!/bin/bash
2 2
3 ##################################################### 3 #####################################################
4 # File : FirstPass.sh # 4 # File : FirstPass.sh #
5 # Brief : ASR first pass and speaker diarization # 5 # Brief : ASR first pass and speaker diarization #
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 # 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 FirstPass.sh 20 # where is FirstPass.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"/CheckFirstPass.sh" 28 . $SCRIPT_PATH"/CheckFirstPass.sh"
29 29
30 # where is FirstPass.cfg 30 # where is FirstPass.cfg
31 FIRSTPASS_CONFIG_FILE=$OTMEDIA_HOME"/cfg/FirstPass.cfg" 31 FIRSTPASS_CONFIG_FILE=$OTMEDIA_HOME"/cfg/FirstPass.cfg"
32 if [ -e $FIRSTPASS_CONFIG_FILE ] 32 if [ -e $FIRSTPASS_CONFIG_FILE ]
33 then 33 then
34 . $FIRSTPASS_CONFIG_FILE 34 . $FIRSTPASS_CONFIG_FILE
35 else 35 else
36 echo "ERROR : Can't find configuration file $FIRSTPASS_CONFIG_FILE" >&2 36 echo "ERROR : Can't find configuration file $FIRSTPASS_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:cf:r" opt 43 while getopts ":hDv:cf:r" opt
44 do 44 do
45 case $opt in 45 case $opt in
46 h) 46 h)
47 echo -e "$0 [OPTIONS] <WAV_FILE> <OUTPUT_DIRECTORY>\n" 47 echo -e "$0 [OPTIONS] <WAV_FILE> <OUTPUT_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 :\tCheck process, stop if error detected" 52 echo -e "\t\t-c :\tCheck process, stop if error detected"
53 echo -e "\t\t-f n :\tspecify a speeral forks number (default 1)" 53 echo -e "\t\t-f n :\tspecify a speeral forks number (default 1)"
54 echo -e "\t\t-r :\tforce rerun the wav file" 54 echo -e "\t\t-r :\tforce rerun the wav file"
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 REDIRECTION_OUTPUT=""
89 else
90 REDIRECTION_OUTPUT=" > /dev/null 2>&1"
88 fi 91 fi
89 92
90 # mode verbose enable 93 # mode verbose enable
91 if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ; fi 94 if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ; REDIRECTION_OUTPUT=" 2> /dev/null"; fi
92 95
93 # Check USAGE by arguments number 96 # Check USAGE by arguments number
94 if [ $(($#-($OPTIND-1))) -ne 2 ] 97 if [ $(($#-($OPTIND-1))) -ne 2 ]
95 then 98 then
96 echo "BAD USAGE : FirstPass.sh [OPTIONS] <WAV_FILE> <OUTPUT_DIR>" 99 echo "BAD USAGE : FirstPass.sh [OPTIONS] <WAV_FILE> <OUTPUT_DIR>"
97 echo "$0 -h for more info" 100 echo "$0 -h for more info"
98 exit 1 101 exit 1
99 fi 102 fi
100 103
101 shift $((OPTIND-1)) 104 shift $((OPTIND-1))
102 # check audio file - First argument 105 # check audio file - First argument
103 if [ -e $1 ] && [ -s $1 ] 106 if [ -e $1 ] && [ -s $1 ]
104 then 107 then
105 # absolute path to wav file 108 # absolute path to wav file
106 WAV_FILE=$(readlink -e $1) 109 WAV_FILE=$(readlink -e $1)
107 # wav filename 110 # wav filename
108 FILENAME=$(basename $WAV_FILE) 111 FILENAME=$(basename $WAV_FILE)
109 # wav filename without extension 112 # wav filename without extension
110 BASENAME=${FILENAME%.*} 113 BASENAME=${FILENAME%.*}
111 114
112 print_info "=> $BASENAME P1 | $(date +'%d/%m/%y %H:%M:%S')" 1 115 print_info "=> $BASENAME P1 | $(date +'%d/%m/%y %H:%M:%S')" 1
113 print_info "$WAV_FILE OK" 1 116 print_info "$WAV_FILE OK" 1
114 else 117 else
115 print_error "can't find $1 OR file is empty" 118 print_error "can't find $1 OR file is empty"
116 exit 1 119 exit 1
117 fi 120 fi
118 121
119 # check output directory - Second argument 122 # check output directory - Second argument
120 if [ ! -e $2 ] 123 if [ ! -e $2 ]
121 then 124 then
122 mkdir -p $2 125 mkdir -p $2
123 print_info "Make directory $2" 1 126 print_info "Make directory $2" 1
124 fi 127 fi
125 128
126 129
127 #-------------# 130 #-------------#
128 # GLOBAL VARS # 131 # GLOBAL VARS #
129 #-------------# 132 #-------------#
130 OUTPUT_DIR=$(readlink -e $2) # Output directory absolute path 133 OUTPUT_DIR=$(readlink -e $2) # Output directory absolute path
131 OUTPUT_DIR_BASENAME="$OUTPUT_DIR/$BASENAME/" # New OUTPUT_DIR with BASENAME 134 OUTPUT_DIR_BASENAME="$OUTPUT_DIR/$BASENAME/" # New OUTPUT_DIR with BASENAME
132 PLP_FILE="$OUTPUT_DIR_BASENAME/$BASENAME.plp" # Global PLP file 135 PLP_FILE="$OUTPUT_DIR_BASENAME/$BASENAME.plp" # Global PLP file
133 PLP_DIR="$OUTPUT_DIR_BASENAME/PLP/" # Segmented PLP files directory 136 PLP_DIR="$OUTPUT_DIR_BASENAME/PLP/" # Segmented PLP files directory
134 SEG_FILE="$OUTPUT_DIR_BASENAME/$BASENAME.seg" # Global Seg file 137 SEG_FILE="$OUTPUT_DIR_BASENAME/$BASENAME.seg" # Global Seg file
135 LBL_FILE="$OUTPUT_DIR_BASENAME/$BASENAME.lbl" # Global LBL file 138 LBL_FILE="$OUTPUT_DIR_BASENAME/$BASENAME.lbl" # Global LBL file
136 RES_DIR=$OUTPUT_DIR_BASENAME"/res_p1" 139 RES_DIR=$OUTPUT_DIR_BASENAME"/res_p1"
137 LOGFILE="$OUTPUT_DIR/info_p1.log" 140 LOGFILE="$OUTPUT_DIR/info_p1.log"
138 ERRORFILE="$OUTPUT_DIR/error_p1.log" 141 ERRORFILE="$OUTPUT_DIR/error_p1.log"
139 142
140 #------------------# 143 #------------------#
141 # Create WORKSPACE # 144 # Create WORKSPACE #
142 #------------------# 145 #------------------#
143 if [ ! -e $OUTPUT_DIR_BASENAME ] 146 if [ ! -e $OUTPUT_DIR_BASENAME ]
144 then 147 then
145 mkdir -p $OUTPUT_DIR_BASENAME 148 mkdir -p $OUTPUT_DIR_BASENAME
146 print_info "Make directory $OUTPUT_DIR_BASENAME" 1 149 print_info "Make directory $OUTPUT_DIR_BASENAME" 1
147 fi 150 fi
148 151
149 # Lock directory 152 # Lock directory
150 if [ -e $OUTPUT_DIR_BASENAME/FIRSTPASS.lock ] && [ $RERUN -eq 0 ]; then exit 1; fi 153 if [ -e $OUTPUT_DIR_BASENAME/FIRSTPASS.lock ] && [ $RERUN -eq 0 ]; then exit 1; fi
151 rm "$OUTPUT_DIR_BASENAME/FIRSTPASS.unlock" > /dev/null 2>&1 154 rm "$OUTPUT_DIR_BASENAME/FIRSTPASS.unlock" > /dev/null 2>&1
152 touch "$OUTPUT_DIR_BASENAME/FIRSTPASS.lock" > /dev/null 2>&1 155 touch "$OUTPUT_DIR_BASENAME/FIRSTPASS.lock" > /dev/null 2>&1
153 156
154 rm -r $PLP_DIR > /dev/null 2>&1; 157 rm -r $PLP_DIR > /dev/null 2>&1;
155 mkdir -p $PLP_DIR 158 mkdir -p $PLP_DIR
156 print_info "Make directory $PLP_DIR" 1 159 print_info "Make directory $PLP_DIR" 1
157 if [ $RERUN -eq 0 ]; 160 if [ $RERUN -eq 0 ];
158 then 161 then
159 rm -r $RES_DIR > /dev/null 2>&1; 162 rm -r $RES_DIR > /dev/null 2>&1;
160 else 163 else
161 rm $RES_DIR/*.lock > /dev/null 2>&1 164 rm $RES_DIR/*.lock > /dev/null 2>&1
162 fi 165 fi
163 mkdir -p $RES_DIR 166 mkdir -p $RES_DIR $REDIRECTION_OUTPUT
164 print_info "Make directory $RES_DIR" 1 167 print_info "Make directory $RES_DIR" 1
165 168
166 #--------------------# 169 #--------------------#
167 # Save configuration # 170 # Save configuration #
168 #--------------------# 171 #--------------------#
169 cp $FIRSTPASS_CONFIG_FILE $OUTPUT_DIR_BASENAME/FirstPass.cfg 172 cp $FIRSTPASS_CONFIG_FILE $OUTPUT_DIR_BASENAME/FirstPass.cfg
170 echo "FIRSTPASS_SCRIPT_PATH=$MAIN_SCRIPT_PATH" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg 173 echo "FIRSTPASS_SCRIPT_PATH=$MAIN_SCRIPT_PATH" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg
171 echo "WAV_FILE=$WAV_FILE" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg 174 echo "WAV_FILE=$WAV_FILE" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg
172 echo "BASENAME=$BASENAME" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg 175 echo "BASENAME=$BASENAME" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg
173 echo "OUTPUT_DIR=$OUTPUT_DIR" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg 176 echo "OUTPUT_DIR=$OUTPUT_DIR" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg
174 echo "OUTPUT_DIR_BASENAME=$OUTPUT_DIR_BASENAME" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg 177 echo "OUTPUT_DIR_BASENAME=$OUTPUT_DIR_BASENAME" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg
175 echo "PLP_FILE=$PLP_FILE" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg 178 echo "PLP_FILE=$PLP_FILE" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg
176 echo "PLP_DIR=$PLP_DIR" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg 179 echo "PLP_DIR=$PLP_DIR" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg
177 echo "SEG_FILE=$SEG_FILE" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg 180 echo "SEG_FILE=$SEG_FILE" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg
178 echo "LBL_FILE=$LBL_FILE" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg 181 echo "LBL_FILE=$LBL_FILE" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg
179 echo "RES_DIR=$RES_DIR" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg 182 echo "RES_DIR=$RES_DIR" >> $OUTPUT_DIR_BASENAME/FirstPass.cfg
180 print_info "save config in $OUTPUT_DIR_BASENAME/FirstPass.cfg" 1 183 print_info "save config in $OUTPUT_DIR_BASENAME/FirstPass.cfg" 1
181 184
182 #-------------------------# 185 #-------------------------#
183 # Check Audio File Format # 186 # Check Audio File Format #
184 #-------------------------# 187 #-------------------------#
185 error=0 188 error=0
186 temp=$(avconv -i $WAV_FILE 2>&1 | grep "16000 Hz") 189 temp=$(avconv -i $WAV_FILE 2>&1 | grep "16000 Hz")
187 if [ -z "$temp" ]; then error=1; fi 190 if [ -z "$temp" ]; then error=1; fi
188 temp=$(avconv -i $WAV_FILE 2>&1 | grep "1 channels") 191 temp=$(avconv -i $WAV_FILE 2>&1 | grep "1 channels")
189 if [ -z "$temp" ]; then error=1; fi 192 if [ -z "$temp" ]; then error=1; fi
190 temp=$(avconv -i $WAV_FILE 2>&1 | grep "s16") 193 temp=$(avconv -i $WAV_FILE 2>&1 | grep "s16")
191 if [ -z "$temp" ]; then error=1; fi 194 if [ -z "$temp" ]; then error=1; fi
192 195
193 if [ $error -eq 1 ] 196 if [ $error -eq 1 ]
194 then 197 then
195 print_message $WARNING 2 "$WAV_FILE is not a wav file at 16000 Hz, 1 channel, 16bits\nhave to convert" 198 print_message $WARNING 2 "$WAV_FILE is not a wav file at 16000 Hz, 1 channel, 16bits\nhave to convert"
196 print_message $INFO 3 "avconv -i $WAV_FILE -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 $OUTPUT_DIR_BASENAME/$BASENAME.wav" 199 print_message $INFO 3 "avconv -i $WAV_FILE -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 $OUTPUT_DIR_BASENAME/$BASENAME.wav"
197 avconv -i $WAV_FILE -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 $OUTPUT_DIR_BASENAME/$BASENAME.wav 200 avconv -i $WAV_FILE -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 $OUTPUT_DIR_BASENAME/$BASENAME.wav $REDIRECTION_OUTPUT
198 WAV_FILE=$OUTPUT_DIR_BASENAME/$BASENAME.wav 201 WAV_FILE=$OUTPUT_DIR_BASENAME/$BASENAME.wav
199 FILENAME=$BASENAME.wav 202 FILENAME=$BASENAME.wav
200 print_message $INFO 1 "new wav file : $WAV_FILE" 203 print_message $INFO 1 "new wav file : $WAV_FILE"
201 fi 204 fi
202 205
203 #---------------# 206 #---------------#
204 # Get SRT file # 207 # Get SRT file #
205 #---------------# 208 #---------------#
206 if [ -s $(dirname $WAV_FILE)/$BASENAME.SRT ] 209 if [ -s $(dirname $WAV_FILE)/$BASENAME.SRT ]
207 then 210 then
208 cp $(dirname $WAV_FILE)/$BASENAME.SRT $OUTPUT_DIR_BASENAME/$BASENAME.SRT 211 cp $(dirname $WAV_FILE)/$BASENAME.SRT $OUTPUT_DIR_BASENAME/$BASENAME.SRT
209 print_info "copy $BASENAME.SRT file into workingspace" 1 212 print_info "copy $BASENAME.SRT file into workingspace" 1
210 fi 213 fi
211 214
212 #------------# 215 #------------#
213 # WAV -> PLP # 216 # WAV -> PLP #
214 #------------# 217 #------------#
215 print_info "convert WAV -> PLP" 1 218 print_info "convert WAV -> PLP" 1
216 echo $FILENAME > $OUTPUT_DIR_BASENAME/list.tmp 219 echo $FILENAME > $OUTPUT_DIR_BASENAME/list.tmp
217 print_info "$BIN_PATH/lia_plp_mt.32 --lst $OUTPUT_DIR_BASENAME/list.tmp --input_dir $(dirname $WAV_FILE) --output_dir $OUTPUT_DIR_BASENAME --input_type WAV --output_type HTK --nb_coef 12 --cms 220 print_info "$BIN_PATH/lia_plp_mt.32 --lst $OUTPUT_DIR_BASENAME/list.tmp --input_dir $(dirname $WAV_FILE) --output_dir $OUTPUT_DIR_BASENAME --input_type WAV --output_type HTK --nb_coef 12 --cms
218 " 2 221 " 2
219 222
220 $BIN_PATH/lia_plp_mt$ARCH --lst $OUTPUT_DIR_BASENAME/list.tmp --input_dir $(dirname $WAV_FILE) --output_dir $OUTPUT_DIR_BASENAME --input_type WAV --output_type HTK --nb_coef 12 --cms 223 $BIN_PATH/lia_plp_mt$ARCH --lst $OUTPUT_DIR_BASENAME/list.tmp --input_dir $(dirname $WAV_FILE) --output_dir $OUTPUT_DIR_BASENAME --input_type WAV --output_type HTK --nb_coef 12 --cms $REDIRECTION_OUTPUT
221 224
222 if [ $CHECK -eq 1 ] 225 if [ $CHECK -eq 1 ]
223 then 226 then
224 check_first_pass_plp "$PLP_FILE" 227 check_first_pass_plp "$PLP_FILE"
225 if [ $? -eq 1 ] 228 if [ $? -eq 1 ]
226 then 229 then
227 echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $PLP_FILE" >> $ERRORFILE 230 echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $PLP_FILE" >> $ERRORFILE
228 exit 1 231 exit 1
229 fi 232 fi
230 fi 233 fi
231 234
232 rm $OUTPUT_DIR_BASENAME/list.tmp 235 rm $OUTPUT_DIR_BASENAME/list.tmp
233 236
234 #------------------------------# 237 #------------------------------#
235 # S/NS + SPEAKERS SEGMENTATION # 238 # S/NS + SPEAKERS SEGMENTATION #
236 #------------------------------# 239 #------------------------------#
237 print_info "Launch speakers diarization" 1 240 print_info "Launch speakers diarization" 1
238 # Calcul seg file 241 # Calcul seg file
239 print_info "java -Xmx4096m -jar $BIN_PATH/LIUM_SpkDiarization-4.2.jar --fInputMask=${WAV_FILE} --sOutputMask=${SEG_FILE} $BASENAME" 2 242 print_info "java -Xmx4096m -jar $BIN_PATH/LIUM_SpkDiarization-4.2.jar --fInputMask=${WAV_FILE} --sOutputMask=${SEG_FILE} $BASENAME" 2
240 #java -Xmx8000m -Xms2048 -jar $BIN_PATH/LIUM_SpkDiarization-4.2.jar --fInputMask=${WAV_FILE} --sOutputMask=${SEG_FILE} $BASENAME 243 #java -Xmx8000m -Xms2048 -jar $BIN_PATH/LIUM_SpkDiarization-4.2.jar --fInputMask=${WAV_FILE} --sOutputMask=${SEG_FILE} $BASENAME
241 java -Xmx4096m -jar $BIN_PATH/LIUM_SpkDiarization-4.2.jar --fInputMask=${WAV_FILE} --sOutputMask=${SEG_FILE} $BASENAME #–doCEClustering 244 java -Xmx4096m -jar $BIN_PATH/LIUM_SpkDiarization-4.2.jar --fInputMask=${WAV_FILE} --sOutputMask=${SEG_FILE} $BASENAME $REDIRECTION_OUTPUT #–doCEClustering
242 245
243 if [ $CHECK -eq 1 ] && ( [ ! -e $SEG_FILE ] || [ -z $SEG_FILE ] ) 246 if [ $CHECK -eq 1 ] && ( [ ! -e $SEG_FILE ] || [ -z $SEG_FILE ] )
244 then 247 then
245 echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $SEG_FILE" >> $ERRORFILE 248 echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $SEG_FILE" >> $ERRORFILE
246 exit 1 249 exit 1
247 fi 250 fi
248 251
249 252
250 # Create LBL file 253 # Create LBL file
251 print_info "Extract LBL file from SEG file" 2 254 print_info "Extract LBL file from SEG file" 2
252 255
253 cat $SEG_FILE | grep -v ";;" | cut -f3,4,5,8 -d" " | tr " " "#" | sort -k1 -n | tr "#" " " > $LBL_FILE 256 cat $SEG_FILE | grep -v ";;" | cut -f3,4,5,8 -d" " | tr " " "#" | sort -k1 -n | tr "#" " " > $LBL_FILE
254 257
255 if [ $CHECK -eq 1 ] && ( [ ! -e $LBL_FILE ] || [ -z $LBL_FILE ] ) 258 if [ $CHECK -eq 1 ] && ( [ ! -e $LBL_FILE ] || [ -z $LBL_FILE ] )
256 then 259 then
257 echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $LBL_FILE" >> $ERRORFILE 260 echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $LBL_FILE" >> $ERRORFILE
258 exit 1 261 exit 1
259 fi 262 fi
260 263
261 264
262 #----------------------------------------------------# 265 #----------------------------------------------------#
263 # Cut global PLP file depending to LBL segmentations # 266 # Cut global PLP file depending to LBL segmentations #
264 #----------------------------------------------------# 267 #----------------------------------------------------#
265 print_info "Cut PLP file depending to LBL segmentations" 1 268 print_info "Cut PLP file depending to LBL segmentations" 1
266 print_info "$BIN_PATH/gcep $PLP_FILE $LBL_FILE 500 $PLP_DIR -FSEG" 2 269 print_info "$BIN_PATH/gcep $PLP_FILE $LBL_FILE 500 $PLP_DIR -FSEG" 2
267 270
268 $SPEERAL_TOOLS/gcep $PLP_FILE $LBL_FILE 500 $PLP_DIR -FSEG 271 $SPEERAL_TOOLS/gcep $PLP_FILE $LBL_FILE 500 $PLP_DIR -FSEG $REDIRECTION_OUTPUT
269 272
270 if [ $CHECK -eq 1 ] 273 if [ $CHECK -eq 1 ]
271 then 274 then
272 check_first_pass_plps_lbl $PLP_DIR $LBL_FILE 275 check_first_pass_plps_lbl $PLP_DIR $LBL_FILE
273 if [ $? -eq 1 ] 276 if [ $? -eq 1 ]
274 then 277 then
275 echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $PLP wrong .plp files number" >> $ERRORFILE 278 echo "ERROR [$(date +'%d/%m/%y %H:%M:%S')] $PLP wrong .plp files number" >> $ERRORFILE
276 exit 1 279 exit 1
277 fi 280 fi
278 fi 281 fi
279 282
280 # change plp files names 283 # change plp files names
281 cd $PLP_DIR; 284 cd $PLP_DIR;
282 rename -f s/_/#/g *plp 285 rename -f s/_/#/g *plp
283 rename -f s/#/_/ *plp 286 rename -f s/#/_/ *plp
284 cd $OLDPWD 287 cd $OLDPWD
285 288
286 #---------------------------------------------# 289 #---------------------------------------------#
287 # PLP files list depending to acoustic models # 290 # PLP files list depending to acoustic models #
288 #---------------------------------------------# 291 #---------------------------------------------#
289 print_info "Create PLP list depending of the model" 1 292 print_info "Create PLP list depending of the model" 1
290 # Create a list of plp files 293 # Create a list of plp files
291 find $PLP_DIR -type f -exec basename "{}" .plp \; | sort > $OUTPUT_DIR_BASENAME/plp.lst 294 find $PLP_DIR -type f -exec basename "{}" .plp \; | sort > $OUTPUT_DIR_BASENAME/plp.lst
292 295
293 rm $OUTPUT_DIR_BASENAME/plp_*.lst > /dev/null 2>&1 296 rm $OUTPUT_DIR_BASENAME/plp_*.lst > /dev/null 2>&1
294 for (( i=0; $i<${#MTAG[@]} ; i++ )) 297 for (( i=0; $i<${#MTAG[@]} ; i++ ))
295 do 298 do
296 a=`grep -e "${MTAG[$i]}" $OUTPUT_DIR_BASENAME/plp.lst` 299 a=`grep -e "${MTAG[$i]}" $OUTPUT_DIR_BASENAME/plp.lst`
297 if [ -n "$a" ]; then 300 if [ -n "$a" ]; then
298 print_info "$OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst" 3 301 print_info "$OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst" 3
299 grep -e "${MTAG[$i]}" $OUTPUT_DIR_BASENAME/plp.lst | sort > $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst 302 grep -e "${MTAG[$i]}" $OUTPUT_DIR_BASENAME/plp.lst | sort > $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst
300 fi 303 fi
301 done 304 done
302 305
303 #-----------------------# 306 #-----------------------#
304 # First Pass (DECODING) # 307 # First Pass (DECODING) #
305 #-----------------------# 308 #-----------------------#
306 # 309 #
307 # For all AM do decoding 310 # For all AM do decoding
308 # if Check error -> iter on undone decoding (max 1 times) 311 # if Check error -> iter on undone decoding (max 1 times)
309 # 312 #
310 print_info "Launch decoding" 1 313 print_info "Launch decoding" 1
311 for (( i=0; $i<${#MTAG[@]} ; i++ )) 314 for (( i=0; $i<${#MTAG[@]} ; i++ ))
312 do 315 do
313 redo=1; # nb of try if not all segs is decoded 316 redo=1; # nb of try if not all segs is decoded
314 if [ -e $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst ] 317 if [ -e $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst ]
315 then 318 then
316 todo=$OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst 319 todo=$OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst
317 while [ $redo -gt 0 ]; do 320 while [ $redo -gt 0 ]; do
318 rm $RES_DIR/*.lock > /dev/null 2>&1 321 rm $RES_DIR/*.lock > /dev/null 2>&1
319 print_info "$SPEERAL_BIN $todo $RES_DIR ${SPEERAL_CFG[$i]} -r $PLP_DIR -m $SPEERAL_AM/${MODS[$i]}.hmm -c $SPEERAL_AM/${MODS[$i]}.cls $FORKS --lock" 2 322 print_info "$SPEERAL_BIN $todo $RES_DIR ${SPEERAL_CFG[$i]} -r $PLP_DIR -m $SPEERAL_AM/${MODS[$i]}.hmm -c $SPEERAL_AM/${MODS[$i]}.cls $FORKS --lock $REDIRECTION_OUTPUT" 2
320 # Run speeral 323 # Run speeral
321 $SPEERAL_BIN ${todo} $RES_DIR ${SPEERAL_CFG[$i]} -r $PLP_DIR -m $SPEERAL_AM/${MODS[$i]}.hmm -c $SPEERAL_AM/${MODS[$i]}.cls $FORKS --lock 324 $SPEERAL_BIN ${todo} $RES_DIR ${SPEERAL_CFG[$i]} -r $PLP_DIR -m $SPEERAL_AM/${MODS[$i]}.hmm -c $SPEERAL_AM/${MODS[$i]}.cls $FORKS --lock $REDIRECTION_OUTPUT
322 325
323 # Check if error 326 # Check if error
324 if [ $CHECK -eq 1 ] 327 if [ $CHECK -eq 1 ]
325 then 328 then
326 check_first_pass_output_speeral "${OUTPUT_DIR_BASENAME}/plp_${MODS[$i]}.lst" "$RES_DIR" 329 check_first_pass_output_speeral "${OUTPUT_DIR_BASENAME}/plp_${MODS[$i]}.lst" "$RES_DIR"
327 # if error 330 # if error
328 if [ $? -eq 1 ] 331 if [ $? -eq 1 ]
329 then 332 then
330 # rerun 333 # rerun
331 redo=$(($redo - 1)); 334 redo=$(($redo - 1));
332 echo -e "WARN : Speeral output ERROR ${OUTPUT_DIR_BASENAME}/plp_${MODS[$i]}.lst" >> $ERRORFILE 335 echo -e "WARN : Speeral output ERROR ${OUTPUT_DIR_BASENAME}/plp_${MODS[$i]}.lst" >> $ERRORFILE
333 # new plp list 336 # new plp list
334 # list .seg done and compare to list of seg to do 337 # list .seg done and compare to list of seg to do
335 ls $RES_DIR/*.seg | grep -e "${MTAG[$i]}" | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp 338 ls $RES_DIR/*.seg | grep -e "${MTAG[$i]}" | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp
336 diff ${OUTPUT_DIR_BASENAME}/plp_${MODS[$i]}.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" > ${OUTPUT_DIR_BASENAME}/todo.lst 339 diff ${OUTPUT_DIR_BASENAME}/plp_${MODS[$i]}.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" > ${OUTPUT_DIR_BASENAME}/todo.lst
337 rm ${OUTPUT_DIR_BASENAME}/.tmp 340 rm ${OUTPUT_DIR_BASENAME}/.tmp
338 # log seg to do 341 # log seg to do
339 cat ${OUTPUT_DIR_BASENAME}/todo.lst >> $ERRORFILE 342 cat ${OUTPUT_DIR_BASENAME}/todo.lst >> $ERRORFILE
340 todo=${OUTPUT_DIR_BASENAME}/todo.lst 343 todo=${OUTPUT_DIR_BASENAME}/todo.lst
341 echo -e "WARN : Try $redo" >> $ERRORFILE 344 echo -e "WARN : Try $redo" >> $ERRORFILE
342 fi 345 fi
343 else 346 else
344 redo=-5; 347 redo=-5;
345 fi 348 fi
346 done 349 done
347 if [ $redo -eq 0 ] 350 if [ $redo -eq 0 ]
348 then 351 then
349 echo -e "ERROR : Speeral $todo" >> $ERRORFILE 352 echo -e "ERROR : Speeral $todo" >> $ERRORFILE
350 cat ${OUTPUT_DIR_BASENAME}/todo.lst >> $ERRORFILE 353 cat ${OUTPUT_DIR_BASENAME}/todo.lst >> $ERRORFILE
351 #exit 1 354 #exit 1
352 fi 355 fi
353 rm ${OUTPUT_DIR_BASENAME}/todo.lst > /dev/null 2>&1 356 rm ${OUTPUT_DIR_BASENAME}/todo.lst > /dev/null 2>&1
354 #rm $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst 357 #rm $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst
355 rm $RES_DIR/*.lock > /dev/null 2>&1 358 rm $RES_DIR/*.lock > /dev/null 2>&1
356 fi 359 fi
357 done 360 done
358 361
359 print_info "<= End P1 $BASENAME | $(date +'%d/%m/%y %H:%M:%S')" 1 362 print_info "<= End P1 $BASENAME | $(date +'%d/%m/%y %H:%M:%S')" 1
360 363
361 ## Check missing seg and log it 364 ## Check missing seg and log it
362 ls $RES_DIR/*.seg | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp 365 ls $RES_DIR/*.seg | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp
363 echo -e "$BASENAME P1 END\n[" >> $LOGFILE 366 echo -e "$BASENAME P1 END\n[" >> $LOGFILE
364 diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE 367 diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE
365 todo=$(cat ${OUTPUT_DIR_BASENAME}/plp.lst | wc -l) 368 todo=$(cat ${OUTPUT_DIR_BASENAME}/plp.lst | wc -l)
366 notdone=$(($todo - $(cat ${OUTPUT_DIR_BASENAME}/.tmp | wc -l))) 369 notdone=$(($todo - $(cat ${OUTPUT_DIR_BASENAME}/.tmp | wc -l)))
367 pourcentage=$((($notdone*100)/$todo)) 370 pourcentage=$((($notdone*100)/$todo))
368 echo -e "] $pourcentage% $BASENAME" >> $LOGFILE 371 echo -e "] $pourcentage% $BASENAME" >> $LOGFILE
369 rm ${OUTPUT_DIR_BASENAME}/.tmp 372 rm ${OUTPUT_DIR_BASENAME}/.tmp
370 373
371 374
372 #---------------# 375 #---------------#
373 # Convert res # 376 # Convert res #
374 #---------------# 377 #---------------#
375 378
376 # .res => .ctm 379 # .res => .ctm
377 $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format CTM --ignore $RULES/asupp --out $OUTPUT_DIR_BASENAME/$BASENAME.1pass.ctm 380 $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format CTM --ignore $RULES/asupp --out $OUTPUT_DIR_BASENAME/$BASENAME.1pass.ctm $REDIRECTION_OUTPUT
378 # .res => .trs 381 # .res => .trs
379 echo -e "name $AUTHOR\nfileName $BASENAME\nfileExt wav\nsegFile $OUTPUT_DIR_BASENAME/$BASENAME.seg" > $OUTPUT_DIR_BASENAME/$BASENAME.trs_cfg 382 echo -e "name $AUTHOR\nfileName $BASENAME\nfileExt wav\nsegFile $OUTPUT_DIR_BASENAME/$BASENAME.seg" > $OUTPUT_DIR_BASENAME/$BASENAME.trs_cfg
380 $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TRS --ignore $RULES/asupp --out $OUTPUT_DIR_BASENAME/$BASENAME.1pass.trs --trs_config $OUTPUT_DIR_BASENAME/$BASENAME.trs_cfg 383 $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TRS --ignore $RULES/asupp --out $OUTPUT_DIR_BASENAME/$BASENAME.1pass.trs --trs_config $OUTPUT_DIR_BASENAME/$BASENAME.trs_cfg $REDIRECTION_OUTPUT
381 rm $OUTPUT_DIR_BASENAME/$BASENAME.trs_cfg 384 rm $OUTPUT_DIR_BASENAME/$BASENAME.trs_cfg 2> /dev/null
382 # .res => .txt 385 # .res => .txt
383 $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TXT --ignore $RULES/asupp --out $OUTPUT_DIR_BASENAME/$BASENAME.1pass.txt 386 $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TXT --ignore $RULES/asupp --out $OUTPUT_DIR_BASENAME/$BASENAME.1pass.txt $REDIRECTION_OUTPUT
384 387
385 # unlock directory 388 # unlock directory
386 mv "$OUTPUT_DIR_BASENAME/FIRSTPASS.lock" "$OUTPUT_DIR_BASENAME/FIRSTPASS.unlock" 389 mv "$OUTPUT_DIR_BASENAME/FIRSTPASS.lock" "$OUTPUT_DIR_BASENAME/FIRSTPASS.unlock"
387 390
main_tools/ScoringRes.sh
1 #!/bin/bash 1 #!/bin/bash
2 2
3 ##################################################### 3 #####################################################
4 # File : ScoringRes.sh # 4 # File : ScoringRes.sh #
5 # Brief : Score result using SRT file # 5 # Brief : Score result using SRT file #
6 # Author : Jean-François Rey # 6 # Author : Jean-François Rey #
7 # Version : 1.0 # 7 # Version : 1.0 #
8 # Date : 11/07/13 # 8 # Date : 11/07/13 #
9 ##################################################### 9 #####################################################
10 10
11 # Check OTMEDIA_HOME env var 11 # Check OTMEDIA_HOME env var
12 if [ -z ${OTMEDIA_HOME} ] 12 if [ -z ${OTMEDIA_HOME} ]
13 then 13 then
14 OTMEDIA_HOME=$(dirname $(dirname $(readlink -e $0))) 14 OTMEDIA_HOME=$(dirname $(dirname $(readlink -e $0)))
15 export OTMEDIA_HOME=$OTMEDIA_HOME 15 export OTMEDIA_HOME=$OTMEDIA_HOME
16 fi 16 fi
17 17
18 # where is ScoringRes.sh 18 # where is ScoringRes.sh
19 MAIN_SCRIPT_PATH=$OTMEDIA_HOME/main_tools 19 MAIN_SCRIPT_PATH=$OTMEDIA_HOME/main_tools
20 20
21 # Scripts Path 21 # Scripts Path
22 SCRIPT_PATH=$OTMEDIA_HOME/tools/scripts 22 SCRIPT_PATH=$OTMEDIA_HOME/tools/scripts
23 23
24 # Include scripts 24 # Include scripts
25 . $SCRIPT_PATH"/Tools.sh" 25 . $SCRIPT_PATH"/Tools.sh"
26 26
27 # where is ScoringRes.cfg 27 # where is ScoringRes.cfg
28 SCORINGRES_CONFIG_FILE=$OTMEDIA_HOME"/cfg/ScoringRes.cfg" 28 SCORINGRES_CONFIG_FILE=$OTMEDIA_HOME"/cfg/ScoringRes.cfg"
29 if [ -e $SCORINGRES_CONFIG_FILE ] 29 if [ -e $SCORINGRES_CONFIG_FILE ]
30 then 30 then
31 . $SCORINGRES_CONFIG_FILE 31 . $SCORINGRES_CONFIG_FILE
32 else 32 else
33 echo "ERROR : Can't find configuration file $SCORINGRES_CONFIG_FILE" >&2 33 echo "ERROR : Can't find configuration file $SCORINGRES_CONFIG_FILE" >&2
34 exit 1 34 exit 1
35 fi 35 fi
36 36
37 #---------------# 37 #---------------#
38 # Parse Options # 38 # Parse Options #
39 #---------------# 39 #---------------#
40 while getopts ":hDv:" opt 40 while getopts ":hDv:" opt
41 do 41 do
42 case $opt in 42 case $opt in
43 h) 43 h)
44 echo -e "$0 [OPTIONS] <PASS_DIRECTORY>\n" 44 echo -e "$0 [OPTIONS] <PASS_DIRECTORY>\n"
45 echo -e "\t Options:" 45 echo -e "\t Options:"
46 echo -e "\t\t-h :\tprint this message" 46 echo -e "\t\t-h :\tprint this message"
47 echo -e "\t\t-D :\tDEBUG mode on" 47 echo -e "\t\t-D :\tDEBUG mode on"
48 echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode" 48 echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode"
49 exit 1 49 exit 1
50 ;; 50 ;;
51 D) 51 D)
52 DEBUG=1 52 DEBUG=1
53 ;; 53 ;;
54 v) 54 v)
55 VERBOSE=$OPTARG 55 VERBOSE=$OPTARG
56 ;; 56 ;;
57 :) 57 :)
58 echo "Option -$OPTARG requires an argument." >&2 58 echo "Option -$OPTARG requires an argument." >&2
59 exit 1 59 exit 1
60 ;; 60 ;;
61 \?) 61 \?)
62 echo "BAD USAGE : unknow opton -$OPTARG" 62 echo "BAD USAGE : unknow opton -$OPTARG"
63 #exit 1 63 #exit 1
64 ;; 64 ;;
65 esac 65 esac
66 66
67 done 67 done
68 68
69 # mode debug enable 69 # mode debug enable
70 if [ $DEBUG -eq 1 ] 70 if [ $DEBUG -eq 1 ]
71 then 71 then
72 set -x 72 set -x
73 echo -e "## Mode DEBUG ON ##" 73 echo -e "## Mode DEBUG ON ##"
74 fi 74 fi
75 75
76 # mode verbose enable 76 # mode verbose enable
77 if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ; fi 77 if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ; fi
78 78
79 # Check USAGE by arguments number 79 # Check USAGE by arguments number
80 if [ $(($#-($OPTIND-1))) -ne 1 ] 80 if [ $(($#-($OPTIND-1))) -ne 1 ]
81 then 81 then
82 echo "BAD USAGE : SecondPass.sh [OPTIONS] <PASS_DIR>" 82 echo "BAD USAGE : SecondPass.sh [OPTIONS] <PASS_DIR>"
83 echo "$0 -h for more info" 83 echo "$0 -h for more info"
84 exit 1 84 exit 1
85 fi 85 fi
86 86
87 shift $((OPTIND-1)) 87 shift $((OPTIND-1))
88 # check Pass directory - First argument 88 # check Pass directory - First argument
89 if [ -e $1 ] && [ -d $1 ] 89 if [ -e $1 ] && [ -d $1 ]
90 then 90 then
91 PASS_DIR=$(readlink -e $1) 91 PASS_DIR=$(readlink -e $1)
92 else 92 else
93 print_error "can't find $1 directory" 93 print_error "can't find $1 directory"
94 exit 1 94 exit 1
95 fi 95 fi
96 96
97 #-------------# 97 #-------------#
98 # GLOBAL VARS # 98 # GLOBAL VARS #
99 #-------------# 99 #-------------#
100 BASENAME=$(basename $PASS_DIR) 100 BASENAME=$(basename $PASS_DIR)
101 SCORING_DIR=$PASS_DIR/scoring 101 SCORING_DIR=$PASS_DIR/scoring
102 LOGFILE="$(dirname $PASS_DIR)/info_scoring.log" 102 LOGFILE="$(dirname $PASS_DIR)/info_scoring.log"
103 ERRORFILE="$(dirname $PASS_DIR)/error_scoring.log" 103 ERRORFILE="$(dirname $PASS_DIR)/error_scoring.log"
104 104
105 #------------------# 105 #------------------#
106 # Create WORKSPACE # 106 # Create WORKSPACE #
107 #------------------# 107 #------------------#
108 108
109 # Lock directory 109 # Lock directory
110 if [ -e $PASS_DIR/*.lock ]; then echo "$PASS_DIR is lock"; exit 1;fi 110 if [ -e $PASS_DIR/*.lock ]; then echo "$PASS_DIR is lock"; exit 1;fi
111 111
112 rm -r $SCORING_DIR > /dev/null 2>&1 112 rm -r $SCORING_DIR > /dev/null 2>&1
113 mkdir -p $SCORING_DIR 113 mkdir -p $SCORING_DIR
114 print_info "Make directory $SCORING_DIR" 1 114 print_info "Make directory $SCORING_DIR" 1
115 115
116 if [ ! -e $PASS_DIR/$BASENAME.SRT ] 116 if [ ! -e $PASS_DIR/$BASENAME.SRT ]
117 then 117 then
118 echo -e "no SRT file for $BASENAME\n" 118 echo -e "no SRT file for $BASENAME\n"
119 exit 0; 119 exit 0;
120 else 120 else
121 SRT_FILE=$PASS_DIR/$BASENAME.SRT 121 SRT_FILE=$PASS_DIR/$BASENAME.SRT
122 fi 122 fi
123 123
124 if [ ! -e $PASS_DIR/$BASENAME.1pass.ctm ] && [ ! -e $PASS_DIR/$BASENAME.2pass.ctm ] && [ ! -e $PASS_DIR/$BASENAME.3pass.ctm ] && [ ! -e $PASS_DIR/$BASENAME.allpass.ctm ] 124 if [ ! -e $PASS_DIR/$BASENAME.1pass.ctm ] && [ ! -e $PASS_DIR/$BASENAME.2pass.ctm ] && [ ! -e $PASS_DIR/$BASENAME.3pass.ctm ] && [ ! -e $PASS_DIR/$BASENAME.allpass.ctm ]
125 then 125 then
126 echo -e "no CTM files for $BASENAME\n"; 126 echo -e "no CTM files for $BASENAME\n";
127 exit 1; 127 exit 1;
128 fi 128 fi
129 129
130 i=$((-3)) 130 i=$((-3))
131 while read line 131 while read line
132 do 132 do
133 i=$(($i + 1)); 133 i=$(($i + 1));
134 if [ $i -eq 4 ] 134 if [ $i -eq 4 ]
135 then 135 then
136 echo " $line" 136 echo " $line"
137 i=$((0)); 137 i=$((0));
138 fi 138 fi
139 done < $SRT_FILE > $SCORING_DIR/$BASENAME.tmp.txt 139 done < $SRT_FILE > $SCORING_DIR/$BASENAME.tmp.txt
140 140
141 #cat $SCORING_DIR/$BASENAME.tmp.txt | sed -e "s|\n| |g" | $SCRIPT_PATH/CleanFilter.sh | $SCRIPT_PATH/ApplyCorrectionRules.pl ${LEXICON}.regex | $SCRIPT_PATH/BdlexUC.pl $RULES/basic -t | sed -e "s|<s>||g" | sed -e "s|</s>||g" | sed -e "s|\n+| |g" > $SCORING_DIR/$BASENAME.tmp2.txt 141 cat $SCORING_DIR/$BASENAME.tmp.txt | sed -e "s|\n| |g" | $SCRIPT_PATH/CleanFilter.sh | $SCRIPT_PATH/ApplyCorrectionRules.pl ${LEXICON}.regex | $SCRIPT_PATH/BdlexUC.pl $RULES/basic -t | sed -e "s|<s>||g" | sed -e "s|</s>||g" | sed -e "s|\n+| |g" > $SCORING_DIR/$BASENAME.tmp2.txt
142 cat $SCORING_DIR/$BASENAME.tmp.txt | sed -e "s|\n| |g" | $SCRIPT_PATH/BdlexUC.pl $RULES/basic -t | sed -f $RULES/preprocess.regex | sed -f $RULES/lastprocess.regex | sed -e "s|<s>||g" | sed -e "s|</s>||g" | sed -e "s|\n+| |g" > $SCORING_DIR/$BASENAME.tmp2.txt 142 #cat $SCORING_DIR/$BASENAME.tmp.txt | sed -e "s|\n| |g" | $SCRIPT_PATH/BdlexUC.pl $RULES/basic -t | sed -f $RULES/preprocess.regex | sed -f $RULES/lastprocess.regex | sed -e "s|<s>||g" | sed -e "s|</s>||g" | sed -e "s|\n+| |g" > $SCORING_DIR/$BASENAME.tmp2.txt
143 143
144 $SCRIPT_PATH/srt2stm.pl $SCORING_DIR/$BASENAME.tmp2.txt > "$SCORING_DIR/$BASENAME.stm" 144 $SCRIPT_PATH/srt2stm.pl $SCORING_DIR/$BASENAME.tmp2.txt > "$SCORING_DIR/$BASENAME.stm"
145 rm $SCORING_DIR/$BASENAME.tmp.txt $SCORING_DIR/$BASENAME.tmp2.txt 145 rm $SCORING_DIR/$BASENAME.tmp.txt $SCORING_DIR/$BASENAME.tmp2.txt
146 146
147 for ctmfile in $(ls $PASS_DIR/*.ctm) 147 for ctmfile in $(ls $PASS_DIR/*.ctm)
148 do 148 do
149 cp $ctmfile $SCORING_DIR/ 149 cp $ctmfile $SCORING_DIR/
150 $BIN_PATH/sclite -D -F -r $SCORING_DIR/$BASENAME.stm stm -h $SCORING_DIR/$(basename $ctmfile) ctm -o all 150 $BIN_PATH/sclite -D -F -r $SCORING_DIR/$BASENAME.stm stm -h $SCORING_DIR/$(basename $ctmfile) ctm -o all
151 done 151 done
152 152
153 153
154 154
155 155
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 # Check OTMEDIA_HOME env var 11 # Check OTMEDIA_HOME env var
12 if [ -z ${OTMEDIA_HOME} ] 12 if [ -z ${OTMEDIA_HOME} ]
13 then 13 then
14 OTMEDIA_HOME=$(dirname $(dirname $(readlink -e $0))) 14 OTMEDIA_HOME=$(dirname $(dirname $(readlink -e $0)))
15 export OTMEDIA_HOME=$OTMEDIA_HOME 15 export OTMEDIA_HOME=$OTMEDIA_HOME
16 fi 16 fi
17 17
18 # where is SecondPass.sh 18 # where is SecondPass.sh
19 MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0)) 19 MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0))
20 20
21 # Scripts Path 21 # Scripts Path
22 SCRIPT_PATH=$OTMEDIA_HOME/tools/scripts 22 SCRIPT_PATH=$OTMEDIA_HOME/tools/scripts
23 23
24 # Include scripts 24 # Include scripts
25 . $SCRIPT_PATH"/Tools.sh" 25 . $SCRIPT_PATH"/Tools.sh"
26 . $SCRIPT_PATH"/CheckThirdPassPass.sh" 26 . $SCRIPT_PATH"/CheckThirdPass.sh"
27 27
28 # where is ThirdPass.cfg 28 # where is ThirdPass.cfg
29 THIRDPASS_CONFIG_FILE=$OTMEDIA_HOME"/cfg/ThirdPass.cfg" 29 THIRDPASS_CONFIG_FILE=$OTMEDIA_HOME"/cfg/ThirdPass.cfg"
30 if [ -e $THIRDPASS_CONFIG_FILE ] 30 if [ -e $THIRDPASS_CONFIG_FILE ]
31 then 31 then
32 . $THIRDPASS_CONFIG_FILE 32 . $THIRDPASS_CONFIG_FILE
33 else 33 else
34 echo "ERROR : Can't find configuration file $THIRDPASS_CONFIG_FILE" >&2 34 echo "ERROR : Can't find configuration file $THIRDPASS_CONFIG_FILE" >&2
35 exit 1 35 exit 1
36 fi 36 fi
37 37
38 #---------------# 38 #---------------#
39 # Parse Options # 39 # Parse Options #
40 #---------------# 40 #---------------#
41 while getopts ":hDv:crf:" opt 41 while getopts ":hDv:crf:" opt
42 do 42 do
43 case $opt in 43 case $opt in
44 h) 44 h)
45 echo -e "$0 [OPTIONS] <PASS_DIRECTORY>\n" 45 echo -e "$0 [OPTIONS] <PASS_DIRECTORY>\n"
46 echo -e "\t Options:" 46 echo -e "\t Options:"
47 echo -e "\t\t-h :\tprint this message" 47 echo -e "\t\t-h :\tprint this message"
48 echo -e "\t\t-D :\tDEBUG mode on" 48 echo -e "\t\t-D :\tDEBUG mode on"
49 echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode" 49 echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode"
50 echo -e "\t\t-c :\t Check process, stop if error detected" 50 echo -e "\t\t-c :\t Check process, stop if error detected"
51 echo -e "\t\t-f n :\tSpecify speeral forks number (default 1)" 51 echo -e "\t\t-f n :\tSpecify speeral forks number (default 1)"
52 echo -e "\t\t-r n :\tforce rerun the show, without deleting works already done" 52 echo -e "\t\t-r n :\tforce rerun the show, without deleting works already done"
53 exit 1 53 exit 1
54 ;; 54 ;;
55 D) 55 D)
56 DEBUG=1 56 DEBUG=1
57 ;; 57 ;;
58 v) 58 v)
59 VERBOSE=$OPTARG 59 VERBOSE=$OPTARG
60 ;; 60 ;;
61 c) 61 c)
62 CHECK=1 62 CHECK=1
63 ;; 63 ;;
64 f) 64 f)
65 FORKS="--forks $OPTARG" 65 FORKS="--forks $OPTARG"
66 ;; 66 ;;
67 r) 67 r)
68 RERUN=1 68 RERUN=1
69 ;; 69 ;;
70 :) 70 :)
71 echo "Option -$OPTARG requires an argument." >&2 71 echo "Option -$OPTARG requires an argument." >&2
72 exit 1 72 exit 1
73 ;; 73 ;;
74 \?) 74 \?)
75 echo "BAD USAGE : unknow opton -$OPTARG" 75 echo "BAD USAGE : unknow opton -$OPTARG"
76 #exit 1 76 #exit 1
77 ;; 77 ;;
78 esac 78 esac
79 done 79 done
80 80
81 # mode debug enable 81 # mode debug enable
82 if [ $DEBUG -eq 1 ] 82 if [ $DEBUG -eq 1 ]
83 then 83 then
84 set -x 84 set -x
85 echo -e "## Mode DEBUG ON ##" 85 echo -e "## Mode DEBUG ON ##"
86 fi 86 fi
87 87
88 # mode verbose enable 88 # mode verbose enable
89 if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ; fi 89 if [ $VERBOSE -gt 0 ]; then echo -e "## Verbose level : $VERBOSE ##" ; fi
90 90
91 # Check USAGE by arguments number 91 # Check USAGE by arguments number
92 if [ $(($#-($OPTIND-1))) -ne 1 ] 92 if [ $(($#-($OPTIND-1))) -ne 1 ]
93 then 93 then
94 echo "BAD USAGE : ThirdPass.sh [OPTIONS] <PASS_DIR>" 94 echo "BAD USAGE : ThirdPass.sh [OPTIONS] <PASS_DIR>"
95 echo "$0 -h for more info" 95 echo "$0 -h for more info"
96 exit 1 96 exit 1
97 fi 97 fi
98 98
99 shift $((OPTIND-1)) 99 shift $((OPTIND-1))
100 # check Pass directory - First argument 100 # check Pass directory - First argument
101 if [ -e $1 ] && [ -d $1 ] 101 if [ -e $1 ] && [ -d $1 ]
102 then 102 then
103 PASS_DIR=$(readlink -e $1) 103 PASS_DIR=$(readlink -e $1)
104 else 104 else
105 print_error "can't find $1 directory" 105 print_error "can't find $1 directory"
106 exit 1 106 exit 1
107 fi 107 fi
108 108
109 #-------------# 109 #-------------#
110 # GLOBAL VARS # 110 # GLOBAL VARS #
111 #-------------# 111 #-------------#
112 EXPLOITCONFPASS_CONFIG_FILE="$PASS_DIR/ExploitConfPass.cfg" 112 EXPLOITCONFPASS_CONFIG_FILE="$PASS_DIR/ExploitConfPass.cfg"
113 if [ -e $EXPLOITCONFPASS_CONFIG_FILE ] 113 if [ -e $EXPLOITCONFPASS_CONFIG_FILE ]
114 then 114 then
115 TRIGGER_SPEERAL=$(cat $EXPLOITCONFPASS_CONFIG_FILE | grep "TRIGGER_SPEERAL=" | cut -f2 -d"=") 115 TRIGGER_SPEERAL=$(cat $EXPLOITCONFPASS_CONFIG_FILE | grep "TRIGGER_SPEERAL=" | cut -f2 -d"=")
116 LEX_SPEERAL=$(cat $EXPLOITCONFPASS_CONFIG_FILE | grep "LEX_SPEERAL=" | cut -f2 -d"=") 116 LEX_SPEERAL=$(cat $EXPLOITCONFPASS_CONFIG_FILE | grep "LEX_SPEERAL=" | cut -f2 -d"=")
117 LEX_BINODE_SPEERAL=$(cat $EXPLOITCONFPASS_CONFIG_FILE | grep "LEX_BINODE_SPEERAL=" | cut -f2 -d"=") 117 LEX_BINODE_SPEERAL=$(cat $EXPLOITCONFPASS_CONFIG_FILE | grep "LEX_BINODE_SPEERAL=" | cut -f2 -d"=")
118 LST="" 118 LST=""
119 PLP_DIR_P1="" 119 PLP_DIR_P1=""
120 HMM="" 120 HMM=""
121 else 121 else
122 print_error "can't find $EXPLOITCONFPASS_CONFIG_FILE file" 122 print_error "can't find $EXPLOITCONFPASS_CONFIG_FILE file"
123 #exit 1 123 #exit 1
124 TRIGGER_SPEERAL=$PASS_DIR/trigg/speeral/ 124 TRIGGER_SPEERAL=$PASS_DIR/trigg/speeral/
125 LEX_SPEERAL=$PASS_DIR/LEX/speeral/LEXIQUE_V6_ext 125 LEX_SPEERAL=$PASS_DIR/LEX/speeral/LEXIQUE_V6_ext
126 LEX_BINODE_SPEERAL=$PASS_DIR/LEX/speeral/LEXIQUE_V6_ext.bin 126 LEX_BINODE_SPEERAL=$PASS_DIR/LEX/speeral/LEXIQUE_V6_ext.bin
127 fi 127 fi
128 SECONDPASS_CONFIG_FILE="$PASS_DIR/SecondPass.cfg" 128 SECONDPASS_CONFIG_FILE="$PASS_DIR/SecondPass.cfg"
129 if [ -e $SECONDPASS_CONFIG_FILE ] 129 if [ -e $SECONDPASS_CONFIG_FILE ]
130 then 130 then
131 LST=$(cat $SECONDPASS_CONFIG_FILE | grep "^LST=" | cut -f2 -d"=") 131 LST=$(cat $SECONDPASS_CONFIG_FILE | grep "^LST=" | cut -f2 -d"=")
132 HMM=$(cat $SECONDPASS_CONFIG_FILE | grep "^HMM=" | cut -f2 -d"=") 132 HMM=$(cat $SECONDPASS_CONFIG_FILE | grep "^HMM=" | cut -f2 -d"=")
133 PLP_DIR_P1=$(cat $SECONDPASS_CONFIG_FILE | grep "^PLP_DIR_P1=" | cut -f2 -d"=") 133 PLP_DIR_P1=$(cat $SECONDPASS_CONFIG_FILE | grep "^PLP_DIR_P1=" | cut -f2 -d"=")
134 else 134 else
135 print_error "can't find $SECONDPASS_CONFIG_FILE file" 135 print_error "can't find $SECONDPASS_CONFIG_FILE file"
136 #exit 1 136 #exit 1
137 LST=$PASS_DIR/lists 137 LST=$PASS_DIR/lists
138 HMM=$PASS_DIR/hmm 138 HMM=$PASS_DIR/hmm
139 PLP_DIR_P1=$PASS_DIR/PLP 139 PLP_DIR_P1=$PASS_DIR/PLP
140 fi 140 fi
141 141
142 BASENAME=$(basename $PASS_DIR) 142 BASENAME=$(basename $PASS_DIR)
143 OUTPUT_DIR_BASENAME=$PASS_DIR 143 OUTPUT_DIR_BASENAME=$PASS_DIR
144 RES_DIR="$PASS_DIR/res_p3" 144 RES_DIR="$PASS_DIR/res_p3"
145 LOGFILE=$(dirname $PASS_DIR)"/info_p3.log" 145 LOGFILE=$(dirname $PASS_DIR)"/info_p3.log"
146 ERRORFILE=$(dirname $PASS_DIR)"/error_p3.log" 146 ERRORFILE=$(dirname $PASS_DIR)"/error_p3.log"
147 147
148 #------------------# 148 #------------------#
149 # Create WORKSPACE # 149 # Create WORKSPACE #
150 #------------------# 150 #------------------#
151 151
152 # Lock directory 152 # Lock directory
153 if [ -e $OUTPUT_DIR_BASENAME/THIRDPASS.lock ] && [ $RERUN -eq 0 ]; then exit 1;fi 153 if [ -e $OUTPUT_DIR_BASENAME/THIRDPASS.lock ] && [ $RERUN -eq 0 ]; then exit 1;fi
154 rm "$OUTPUT_DIR_BASENAME/THIRDPASS.unlock" > /dev/null 2>&1 154 rm "$OUTPUT_DIR_BASENAME/THIRDPASS.unlock" > /dev/null 2>&1
155 touch "$OUTPUT_DIR_BASENAME/THIRDPASS.lock" > /dev/null 2>&1 155 touch "$OUTPUT_DIR_BASENAME/THIRDPASS.lock" > /dev/null 2>&1
156 156
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 158 mkdir -p $RES_DIR
159 print_info "Make directory $RES_DIR" 1 159 print_info "Make directory $RES_DIR" 1
160 160
161 #--------------------# 161 #--------------------#
162 # Save configuration # 162 # Save configuration #
163 #--------------------# 163 #--------------------#
164 cp $THIRDPASS_CONFIG_FILE $OUTPUT_DIR_BASENAME/ThirdPass.cfg 164 cp $THIRDPASS_CONFIG_FILE $OUTPUT_DIR_BASENAME/ThirdPass.cfg
165 echo "RES_DIR=$RES_DIR" >> $OUTPUT_DIR_BASENAME/ThirdPass.cfg 165 echo "RES_DIR=$RES_DIR" >> $OUTPUT_DIR_BASENAME/ThirdPass.cfg
166 print_info "save config in $OUTPUT_DIR_BASENAME/SecondPass.cfg" 1 166 print_info "save config in $OUTPUT_DIR_BASENAME/SecondPass.cfg" 1
167 167
168 #--------------------------------------------------# 168 #--------------------------------------------------#
169 # Third Pass using trigger file (DECODING) # 169 # Third Pass using trigger file (DECODING) #
170 #--------------------------------------------------# 170 #--------------------------------------------------#
171 print_info "Launch Third Pass" 1 171 print_info "Launch Third Pass" 1
172 172
173 ## Generate speeral config file adding trigger rep 173 ## Generate speeral config file adding trigger rep
174 cat $SPEERAL_CFG_PATH/$SPEERAL_CFG_FILE | sed -e "s|<nom>[^<]*</nom>|<nom>$OUTPUT_DIR_BASENAME/LEX/speeral/LEXIQUE_V6_ext</nom>|g" \ 174 cat $SPEERAL_CFG_PATH/$SPEERAL_CFG_FILE | sed -e "s|<nom>[^<]*</nom>|<nom>$OUTPUT_DIR_BASENAME/LEX/speeral/LEXIQUE_V6_ext</nom>|g" \
175 | sed -e "s|<binode>[^<]*</binode>|<binode>$OUTPUT_DIR_BASENAME/LEX/speeral/LEXIQUE_V6_ext.bin</binode>|g" \ 175 | sed -e "s|<binode>[^<]*</binode>|<binode>$OUTPUT_DIR_BASENAME/LEX/speeral/LEXIQUE_V6_ext.bin</binode>|g" \
176 | sed -e "s|<trigger><dir>[^<]*</dir></trigger>|<trigger><dir>$TRIGGER_SPEERAL</dir></trigger>|g" > $OUTPUT_DIR_BASENAME/SpeeralThirdPass.xml 176 | sed -e "s|<trigger><dir>[^<]*</dir></trigger>|<trigger><dir>$TRIGGER_SPEERAL</dir></trigger>|g" > $OUTPUT_DIR_BASENAME/SpeeralThirdPass.xml
177 SPEERAL_THIRD_CFG=$OUTPUT_DIR_BASENAME/SpeeralThirdPass.xml 177 SPEERAL_THIRD_CFG=$OUTPUT_DIR_BASENAME/SpeeralThirdPass.xml
178 178
179 # for all speaker 179 # for all speaker
180 for lspeaker in $(ls $LST/*.lst) 180 for lspeaker in $(ls $LST/*.lst)
181 do 181 do
182 speaker=$(basename $lspeaker ".lst") 182 speaker=$(basename $lspeaker ".lst")
183 # for all AM 183 # for all AM
184 for (( i=0; $i<${#MTAG[@]} ; i++ )) 184 for (( i=0; $i<${#MTAG[@]} ; i++ ))
185 do 185 do
186 if [ -e $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst ]; then 186 if [ -e $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst ]; then
187 type=$(grep -e "${speaker}$" "$OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst") 187 type=$(grep -e "${speaker}$" "$OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst")
188 ## if is the good AM for the speaker 188 ## if is the good AM for the speaker
189 if [ -n "$type" ] 189 if [ -n "$type" ]
190 then 190 then
191 ## Speeral decoding 191 ## Speeral decoding
192 if [ -s $HMM/$speaker.hmm ] && [ -s $HMM/$speaker.cls ] 192 if [ -s $HMM/$speaker.hmm ] && [ -s $HMM/$speaker.cls ]
193 then 193 then
194 print_info "$SPEERAL_BIN $LST/$speaker.lst $RES_DIR $SPEERAL_THIRD_CFG -r $PLP_DIR_P1 -m $HMM/$speaker.hmm -c $HMM/$speaker.cls $FORKS --lock" 3 194 print_info "$SPEERAL_BIN $LST/$speaker.lst $RES_DIR $SPEERAL_THIRD_CFG -r $PLP_DIR_P1 -m $HMM/$speaker.hmm -c $HMM/$speaker.cls $FORKS --lock" 3
195 $SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_THIRD_CFG} -r $PLP_DIR_P1 -m $HMM/$speaker.hmm -c $HMM/$speaker.cls $FORKS --lock 195 $SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_THIRD_CFG} -r $PLP_DIR_P1 -m $HMM/$speaker.hmm -c $HMM/$speaker.cls $FORKS --lock
196 else 196 else
197 print_warn "$HMM/$speaker.hmm and $speaker.cls empty, do default decoding..." 2 197 print_warn "$HMM/$speaker.hmm and $speaker.cls empty, do default decoding..." 2
198 $SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_THIRD_CFG} -r $PLP_DIR_P1 -m $SPEERAL_AM/${MODS[$i]}.hmm -c $SPEERAL_AM/${MODS[$i]}.cls $FORKS --lock 198 $SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_THIRD_CFG} -r $PLP_DIR_P1 -m $SPEERAL_AM/${MODS[$i]}.hmm -c $SPEERAL_AM/${MODS[$i]}.cls $FORKS --lock
199 fi 199 fi
200 200
201 if [ $CHECK -eq 1 ] 201 if [ $CHECK -eq 1 ]
202 then 202 then
203 check_third_pass_output_speeral "$LST/$speaker.lst" "$RES_DIR" 203 check_third_pass_output_speeral "$LST/$speaker.lst" "$RES_DIR"
204 if [ $? -eq 1 ] 204 if [ $? -eq 1 ]
205 then 205 then
206 echo -e "ERROR : Speeral $LST/$speaker.lst\n[" >> $ERRORFILE 206 echo -e "ERROR : Speeral $LST/$speaker.lst\n[" >> $ERRORFILE
207 ls $RES_DIR/*.seg | grep -e "$speaker" | sed -e "s|$RES_DIR\/||" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp 207 ls $RES_DIR/*.seg | grep -e "$speaker" | sed -e "s|$RES_DIR\/||" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp
208 diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp >> $ERRORFILE 208 diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp >> $ERRORFILE
209 echo -e "] " >> $ERRORFILE 209 echo -e "] " >> $ERRORFILE
210 rm ${OUTPUT_DIR_BASENAME}/.tmp 210 rm ${OUTPUT_DIR_BASENAME}/.tmp
211 #exit 1 211 #exit 1
212 fi 212 fi
213 fi 213 fi
214 break 214 break
215 fi 215 fi
216 fi 216 fi
217 done 217 done
218 done 218 done
219 219
220 ## Check missing seg and log it 220 ## Check missing seg and log it
221 ls $RES_DIR/*.res | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.res//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp 221 ls $RES_DIR/*.res | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.res//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp
222 echo -e "$BASENAME P3 END\n[" >> $LOGFILE 222 echo -e "$BASENAME P3 END\n[" >> $LOGFILE
223 diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE 223 diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE
224 echo -e "] $BASENAME" >> $LOGFILE 224 echo -e "] $BASENAME" >> $LOGFILE
225 rm ${OUTPUT_DIR_BASENAME}/.tmp 225 rm ${OUTPUT_DIR_BASENAME}/.tmp
226 226
227 #---------------# 227 #---------------#
228 # Convert res # 228 # Convert res #
229 #---------------# 229 #---------------#
230 230
231 # .res => .ctm 231 # .res => .ctm
232 $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format CTM --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.ctm 232 $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format CTM --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.ctm
233 # .res => .trs 233 # .res => .trs
234 echo -e "name $AUTHOR\nfileName ${BASENAME}\nfileExt wav\nsegFile ${OUTPUT_DIR_BASENAME}/${BASENAME}.seg" > ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg 234 echo -e "name $AUTHOR\nfileName ${BASENAME}\nfileExt wav\nsegFile ${OUTPUT_DIR_BASENAME}/${BASENAME}.seg" > ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg
235 $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TRS --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.trs --trs_config ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg 235 $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TRS --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.trs --trs_config ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg
236 rm ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg 236 rm ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg
237 # .res => .txt 237 # .res => .txt
238 $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TXT --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.txt 238 $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TXT --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.txt
239 239
240 240
241 print_info "<= End $BASENAME P3 | $(date +'%d/%m/%y %H:%M:%S')" 1 241 print_info "<= End $BASENAME P3 | $(date +'%d/%m/%y %H:%M:%S')" 1
242 242
243 # unlock directory 243 # unlock directory
244 mv "$OUTPUT_DIR_BASENAME/THIRDPASS.lock" "$OUTPUT_DIR_BASENAME/THIRDPASS.unlock" 244 mv "$OUTPUT_DIR_BASENAME/THIRDPASS.lock" "$OUTPUT_DIR_BASENAME/THIRDPASS.unlock"
245 245
246 246