Commit 243e31ee2a237f6a0b7d6a75b423343de76b5614

Authored by Jean-François Rey
1 parent 17d865629c
Exists in master

bugfix

Showing 2 changed files with 2 additions and 15 deletions Inline Diff

main_tools/OneScriptToRuleThemAll.sh
1 #!/bin/bash 1 #!/bin/bash
2 2
3 ##################################### 3 #####################################
4 # File: OneScriptToRuleThemAll.sh # 4 # File: OneScriptToRuleThemAll.sh #
5 # Brief : Script to launch OTMEDIA # 5 # Brief : Script to launch OTMEDIA #
6 # Version : 1.0 # 6 # Version : 1.0 #
7 # Date : 23/07/2013 # 7 # Date : 23/07/2013 #
8 # Author : Jean-François Rey # 8 # Author : Jean-François Rey #
9 ##################################### 9 #####################################
10 10
11 # Color variables
12 txtgrn=$(tput setaf 2) # Green
13 txtylw=$(tput setaf 3) # Yellow
14 txtblu=$(tput setaf 4) # Blue
15 txtpur=$(tput setaf 5) # Purple
16 txtcyn=$(tput setaf 6) # Cyan
17 txtwht=$(tput setaf 7) # White
18 txtrst=$(tput sgr0) # Text reset.
19 #/color
20
21
22 echo -e "#### OneScriptToRuleThemAll ####" 11 echo -e "#### OneScriptToRuleThemAll ####"
23 LORD=" Three::rings 12 LORD=" Three::rings
24 for:::the::Elven-King 13 for:::the::Elven-King
25 under:the:sky,:Seven:for:the 14 under:the:sky,:Seven:for:the
26 Dwarf-Lords::in::their::halls:of 15 Dwarf-Lords::in::their::halls:of
27 stone,:Nine for:Mortal 16 stone,:Nine for:Mortal
28 :::Men::: ________ doomed::to 17 :::Men::: ________ doomed::to
29 die.:One _,-'...:... \`-. for:::the 18 die.:One _,-'...:... \`-. for:::the
30 ::Dark:: ,- .:::::::::::. \`. Lord::on 19 ::Dark:: ,- .:::::::::::. \`. Lord::on
31 his:dark ,' .:::::zzz:::::. \`. :throne: 20 his:dark ,' .:::::zzz:::::. \`. :throne:
32 In:::the/ ::::${txtpur}OTMEDIA${txtrst}:::: \ Land::of 21 In:::the/ ::::OTMEDIA:::: \ Land::of
33 :Mordor:\ ::::${txtpur}SCRIPTS${txtrst}:::: / :where:: 22 :Mordor:\ ::::SCRIPTS:::: / :where::
34 ::the::: '. '::::YEEEP::::' ,' Shadows: 23 ::the::: '. '::::YEEEP::::' ,' Shadows:
35 lie.::One \`. \`\`:::::::::'' ,' Ring::to 24 lie.::One \`. \`\`:::::::::'' ,' Ring::to
36 ::rule:: \`-._\`\`\`:'''_,-' ::them:: 25 ::rule:: \`-._\`\`\`:'''_,-' ::them::
37 all,::One \`-----' ring::to 26 all,::One \`-----' ring::to
38 ::find::: them,:One 27 ::find::: them,:One
39 Ring:::::to bring::them 28 Ring:::::to bring::them
40 all::and::in:the:darkness:bind 29 all::and::in:the:darkness:bind
41 them:In:the:Land:of:Mordor 30 them:In:the:Land:of:Mordor
42 where:::the::Shadows 31 where:::the::Shadows
43 :::lie.:::" 32 :::lie.:::"
44 33
45 34
46 # Check OTMEDIA_HOME env var 35 # Check OTMEDIA_HOME env var
47 if [ -z ${OTMEDIA_HOME} ] 36 if [ -z ${OTMEDIA_HOME} ]
48 then 37 then
49 OTMEDIA_HOME=$(dirname $(dirname $(readlink -e $0))) 38 OTMEDIA_HOME=$(dirname $(dirname $(readlink -e $0)))
50 export OTMEDIA_HOME=$OTMEDIA_HOME 39 export OTMEDIA_HOME=$OTMEDIA_HOME
51 fi 40 fi
52 41
53 # where is OneScriptToRuleThemAll.sh 42 # where is OneScriptToRuleThemAll.sh
54 MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0)) 43 MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0))
55 44
56 RING="" 45 RING=""
57 p1=0 46 p1=0
58 p2=0 47 p2=0
59 conf=0 48 conf=0
60 exploitconf=0 49 exploitconf=0
61 p3=0 50 p3=0
62 recompose=0 51 recompose=0
63 scoring=0 52 scoring=0
64 53
65 #---------------# 54 #---------------#
66 # Parse Options # 55 # Parse Options #
67 #---------------# 56 #---------------#
68 while getopts ":hDv:cf:r123C:eRsa" opt 57 while getopts ":hDv:cf:r123C:eRsa" opt
69 do 58 do
70 case $opt in 59 case $opt in
71 h) 60 h)
72 echo -e "$0 [OPTIONS] <WAV_FILE> <OUTPUT_DIRECTORY>\n" 61 echo -e "$0 [OPTIONS] <WAV_FILE> <OUTPUT_DIRECTORY>\n"
73 echo -e "\t Options:" 62 echo -e "\t Options:"
74 echo -e "\t\t-h :\tprint this message" 63 echo -e "\t\t-h :\tprint this message"
75 echo -e "\t\t-D :\tDEBUG mode on" 64 echo -e "\t\t-D :\tDEBUG mode on"
76 echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode" 65 echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode"
77 echo -e "\t\t-c :\tCheck process, stop if error detected" 66 echo -e "\t\t-c :\tCheck process, stop if error detected"
78 echo -e "\t\t-f n :\tSpecify a speeral forks number (default 1)" 67 echo -e "\t\t-f n :\tSpecify a speeral forks number (default 1)"
79 echo -e "\t\t-r :\tForce to rerun without deleting all files" 68 echo -e "\t\t-r :\tForce to rerun without deleting all files"
80 echo -e "\t\t-a :\tDo every pass" 69 echo -e "\t\t-a :\tDo every pass"
81 echo -e "\t\t-1 :\tDo 1rt pass" 70 echo -e "\t\t-1 :\tDo 1rt pass"
82 echo -e "\t\t-2 :\tDo 2nd pass" 71 echo -e "\t\t-2 :\tDo 2nd pass"
83 echo -e "\t\t-3 :\tDo 3rd pass" 72 echo -e "\t\t-3 :\tDo 3rd pass"
84 echo -e "\t\t-C p :\tDo p confidence pass (1=all, 2 or 3)" 73 echo -e "\t\t-C p :\tDo p confidence pass (1=all, 2 or 3)"
85 echo -e "\t\t-e :\tDo exploit confidence pass (SOLR)" 74 echo -e "\t\t-e :\tDo exploit confidence pass (SOLR)"
86 echo -e "\t\t-R :\tDo recompose res" 75 echo -e "\t\t-R :\tDo recompose res"
87 echo -e "\t\t-s :\tDo scoring" 76 echo -e "\t\t-s :\tDo scoring"
88 exit 1 77 exit 1
89 ;; 78 ;;
90 D) 79 D)
91 RING=$RING" -D" 80 RING=$RING" -D"
92 ;; 81 ;;
93 v) 82 v)
94 RING=$RING" -v $OPTARG" 83 RING=$RING" -v $OPTARG"
95 ;; 84 ;;
96 c) 85 c)
97 RING=$RING" -c" 86 RING=$RING" -c"
98 ;; 87 ;;
99 f) 88 f)
100 FORKS=" -f $OPTARG" 89 FORKS=" -f $OPTARG"
101 ;; 90 ;;
102 r) 91 r)
103 RING=$RING" -r" 92 RING=$RING" -r"
104 ;; 93 ;;
105 a) 94 a)
106 p1=1 95 p1=1
107 p2=1 96 p2=1
108 p3=1 97 p3=1
109 conf=1 98 conf=1
110 exploitconf=1 99 exploitconf=1
111 recompose=1 100 recompose=1
112 scoring=1 101 scoring=1
113 ;; 102 ;;
114 1) 103 1)
115 p1=1 104 p1=1
116 ;; 105 ;;
117 2) 106 2)
118 p2=1 107 p2=1
119 ;; 108 ;;
120 3) 109 3)
121 p3=1 110 p3=1
122 ;; 111 ;;
123 C) 112 C)
124 conf=$OPTARG 113 conf=$OPTARG
125 ;; 114 ;;
126 e) 115 e)
127 exploitconf=1 116 exploitconf=1
128 ;; 117 ;;
129 R) 118 R)
130 recompose=1 119 recompose=1
131 ;; 120 ;;
132 s) 121 s)
133 scoring=1 122 scoring=1
134 ;; 123 ;;
135 :) 124 :)
136 echo "Option -$OPTARG requires an argument." >&2 125 echo "Option -$OPTARG requires an argument." >&2
137 exit 1 126 exit 1
138 ;; 127 ;;
139 \?) 128 \?)
140 echo "BAD USAGE : unknow opton -$OPTARG" 129 echo "BAD USAGE : unknow opton -$OPTARG"
141 exit 1 130 exit 1
142 ;; 131 ;;
143 esac 132 esac
144 done 133 done
145 134
146 # Check USAGE by arguments number 135 # Check USAGE by arguments number
147 if [ $(($#-($OPTIND-1))) -ne 2 ] 136 if [ $(($#-($OPTIND-1))) -ne 2 ]
148 then 137 then
149 echo "BAD USAGE : $0 [OPTIONS] <WAV_FILE> <OUTPUT_DIR>" 138 echo "BAD USAGE : $0 [OPTIONS] <WAV_FILE> <OUTPUT_DIR>"
150 echo "$0 -h for more info" 139 echo "$0 -h for more info"
151 exit 1 140 exit 1
152 fi 141 fi
153 142
154 shift $((OPTIND-1)) 143 shift $((OPTIND-1))
155 # check audio file - First argument 144 # check audio file - First argument
156 if [ -e $1 ] && [ -s $1 ] 145 if [ -e $1 ] && [ -s $1 ]
157 then 146 then
158 echo -e "$LORD\n" 147 echo -e "$LORD\n"
159 REP_OUT=$2/$(basename ${1%.*}) 148 REP_OUT=$2/$(basename ${1%.*})
160 if [ $p1 -eq 1 ];then ${MAIN_SCRIPT_PATH}/FirstPass.sh ${RING} ${FORKS} $1 $2;fi 149 if [ $p1 -eq 1 ];then ${MAIN_SCRIPT_PATH}/FirstPass.sh ${RING} ${FORKS} $1 $2;fi
161 if [ $p2 -eq 1 ];then ${MAIN_SCRIPT_PATH}/SecondPass.sh ${RING} ${FORKS} ${REP_OUT};fi 150 if [ $p2 -eq 1 ];then ${MAIN_SCRIPT_PATH}/SecondPass.sh ${RING} ${FORKS} ${REP_OUT};fi
162 if [ $conf -eq 1 ] || [ $conf -eq 2 ];then $p${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p2";fi 151 if [ $conf -eq 1 ] || [ $conf -eq 2 ];then $p${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p2";fi
163 if [ $exploitconf -eq 1 ]; then ${MAIN_SCRIPT_PATH}/ExploitConfidencePass.sh ${RING} ${REP_OUT};fi 152 if [ $exploitconf -eq 1 ]; then ${MAIN_SCRIPT_PATH}/ExploitConfidencePass.sh ${RING} ${REP_OUT};fi
164 if [ $p3 -eq 1 ];then ${MAIN_SCRIPT_PATH}/ThirdPass.sh ${RING} ${FORKS} ${REP_OUT};fi 153 if [ $p3 -eq 1 ];then ${MAIN_SCRIPT_PATH}/ThirdPass.sh ${RING} ${FORKS} ${REP_OUT};fi
165 if [ $conf -eq 1 ] || [ $conf -eq 3 ];then ${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p3";fi 154 if [ $conf -eq 1 ] || [ $conf -eq 3 ];then ${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p3";fi
166 if [ $recompose -eq 1 ];then ${MAIN_SCRIPT_PATH}/RecomposePass.sh ${RING} ${REP_OUT};fi 155 if [ $recompose -eq 1 ];then ${MAIN_SCRIPT_PATH}/RecomposePass.sh ${RING} ${REP_OUT};fi
167 if [ $scoring -eq 1 ];then ${MAIN_SCRIPT_PATH}/ScoringRes.sh ${RING} ${REP_OUT};fi 156 if [ $scoring -eq 1 ];then ${MAIN_SCRIPT_PATH}/ScoringRes.sh ${RING} ${REP_OUT};fi
168 echo "done" 157 echo "done"
169 else 158 else
170 echo "can't find $1 OR file is empty" 159 echo "can't find $1 OR file is empty"
171 exit 1 160 exit 1
172 fi 161 fi
173 162
174 163
175 164
176 165
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_LIST_P1=$(cat $SECONDPASS_CONFIG_FILE | grep "^PLP_LIST_P1=" | cut -f2 -d"=") 141 PLP_LIST_P1=$(cat $SECONDPASS_CONFIG_FILE | grep "^PLP_LIST_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_LIST_P1=$PASS_DIR/plp.lst 149 PLP_LIST_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 rm $LOGFILE $ERRORFILE 2>/dev/null 170 rm $LOGFILE $ERRORFILE 2>/dev/null
171 #--------------------# 171 #--------------------#
172 # Save configuration # 172 # Save configuration #
173 #--------------------# 173 #--------------------#
174 cp $THIRDPASS_CONFIG_FILE $OUTPUT_DIR_BASENAME/ThirdPass.cfg 174 cp $THIRDPASS_CONFIG_FILE $OUTPUT_DIR_BASENAME/ThirdPass.cfg
175 echo "RES_DIR=$RES_DIR" >> $OUTPUT_DIR_BASENAME/ThirdPass.cfg 175 echo "RES_DIR=$RES_DIR" >> $OUTPUT_DIR_BASENAME/ThirdPass.cfg
176 print_info "[${BASENAME}] Save config in $OUTPUT_DIR_BASENAME/ThirdPass.cfg" 1 176 print_info "[${BASENAME}] Save config in $OUTPUT_DIR_BASENAME/ThirdPass.cfg" 1
177 177
178 #--------------------------------------------------# 178 #--------------------------------------------------#
179 # Third Pass using trigger file (DECODING) # 179 # Third Pass using trigger file (DECODING) #
180 #--------------------------------------------------# 180 #--------------------------------------------------#
181 print_info "[${BASENAME}] Launch Third Pass" 1 181 print_info "[${BASENAME}] Launch Third Pass" 1
182 182
183 ## Generate speeral config file adding trigger rep 183 ## Generate speeral config file adding trigger rep
184 cat $SPEERAL_CFG_PATH/$SPEERAL_CFG_FILE | sed -e "s|<nom>[^<]*</nom>|<nom>$OUTPUT_DIR_BASENAME/LEX/speeral/LEXIQUE_V6_ext</nom>|g" \ 184 cat $SPEERAL_CFG_PATH/$SPEERAL_CFG_FILE | sed -e "s|<nom>[^<]*</nom>|<nom>$OUTPUT_DIR_BASENAME/LEX/speeral/LEXIQUE_V6_ext</nom>|g" \
185 | sed -e "s|<binode>[^<]*</binode>|<binode>$OUTPUT_DIR_BASENAME/LEX/speeral/LEXIQUE_V6_ext.bin</binode>|g" \ 185 | sed -e "s|<binode>[^<]*</binode>|<binode>$OUTPUT_DIR_BASENAME/LEX/speeral/LEXIQUE_V6_ext.bin</binode>|g" \
186 | sed -e "s|<trigger><dir>[^<]*</dir></trigger>|<trigger><dir>$TRIGGER_SPEERAL</dir></trigger>|g" > $OUTPUT_DIR_BASENAME/SpeeralThirdPass.xml 186 | sed -e "s|<trigger><dir>[^<]*</dir></trigger>|<trigger><dir>$TRIGGER_SPEERAL</dir></trigger>|g" > $OUTPUT_DIR_BASENAME/SpeeralThirdPass.xml
187 SPEERAL_THIRD_CFG=$OUTPUT_DIR_BASENAME/SpeeralThirdPass.xml 187 SPEERAL_THIRD_CFG=$OUTPUT_DIR_BASENAME/SpeeralThirdPass.xml
188 print_info "[${BASENAME}] Third Pass Speeral Config file ${SPEERAL_THIRD_CFG}" 3 188 print_info "[${BASENAME}] Third Pass Speeral Config file ${SPEERAL_THIRD_CFG}" 3
189 189
190 # for all speaker 190 # for all speaker
191 for lspeaker in $(ls $LST/*.lst) 191 for lspeaker in $(ls $LST/*.lst)
192 do 192 do
193 speaker=$(basename $lspeaker ".lst") 193 speaker=$(basename $lspeaker ".lst")
194 # for all AM 194 # for all AM
195 for (( i=0; $i<${#MTAG[@]} ; i++ )) 195 for (( i=0; $i<${#MTAG[@]} ; i++ ))
196 do 196 do
197 if [ -e $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst ]; then 197 if [ -e $OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst ]; then
198 type=$(grep -e "${speaker}$" "$OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst") 198 type=$(grep -e "${speaker}$" "$OUTPUT_DIR_BASENAME/plp_${MODS[$i]}.lst")
199 ## if is the good AM for the speaker 199 ## if is the good AM for the speaker
200 if [ -n "$type" ] 200 if [ -n "$type" ]
201 then 201 then
202 ## Speeral decoding 202 ## Speeral decoding
203 if [ -s $HMM/$speaker.hmm ] && [ -s $HMM/$speaker.cls ] 203 if [ -s $HMM/$speaker.hmm ] && [ -s $HMM/$speaker.cls ]
204 then 204 then
205 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 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
206 $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 $SPEERAL_BIN $LST/$speaker.lst $RES_DIR ${SPEERAL_THIRD_CFG} -r $PLP_DIR_P1 -m $HMM/$speaker.hmm -c $HMM/$speaker.cls $FORKS --lock
207 else 207 else
208 print_warn "[${BASENAME}] $HMM/$speaker.hmm and $speaker.cls empty, do default decoding..." 2 208 print_warn "[${BASENAME}] $HMM/$speaker.hmm and $speaker.cls empty, do default decoding..." 2
209 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 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
210 $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 $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
211 fi 211 fi
212 212
213 if [ $CHECK -eq 1 ] 213 if [ $CHECK -eq 1 ]
214 then 214 then
215 check_third_pass_output_speeral "$LST/$speaker.lst" "$RES_DIR" 215 check_third_pass_output_speeral "$LST/$speaker.lst" "$RES_DIR"
216 if [ $? -eq 1 ] 216 if [ $? -eq 1 ]
217 then 217 then
218 218
219 print_warn "[${BASENAME}] Speeral output error : check $LOGFILE" 2 219 print_warn "[${BASENAME}] Speeral output error : check $LOGFILE" 2
220 print_log_file $LOGFILE "WARN : Speeral number of output ERROR $LST/$speaker.lst" 220 print_log_file $LOGFILE "WARN : Speeral number of output ERROR $LST/$speaker.lst"
221 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 ls $RES_DIR/*.seg 2>/dev/null | grep -e "$speaker" | sed -e "s|$RES_DIR\/||" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp
222 print_log_file $LOGFILE "Segs (and treil) not done :\n[" 222 print_log_file $LOGFILE "Segs (and treil) not done :\n["
223 diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE 223 diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE
224 print_log_file $LOGFILE "] [$(date +'%d/%m/%y %H:%M:%S')]" 224 print_log_file $LOGFILE "] [$(date +'%d/%m/%y %H:%M:%S')]"
225 rm ${OUTPUT_DIR_BASENAME}/.tmp 225 rm ${OUTPUT_DIR_BASENAME}/.tmp
226 fi 226 fi
227 fi 227 fi
228 break 228 break
229 fi 229 fi
230 fi 230 fi
231 done 231 done
232 done 232 done
233 233
234 ## Check missing seg and log it 234 ## Check missing seg and log it
235
236 ## Check missing seg and log it
237 if [ $CHECK -eq 1 ] 235 if [ $CHECK -eq 1 ]
238 then 236 then
239 ls $RES_DIR/*.treil 2>/dev/null | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.treil//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp 237 ls $RES_DIR/*.treil 2>/dev/null | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.treil//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp
240 todo=$(cat ${PLP_LIST_P1} 2>/dev/null | wc -l) 238 todo=$(cat ${PLP_LIST_P1} 2>/dev/null | wc -l)
241 if [ $todo -eq 0 ]; then todo=1;fi 239 if [ $todo -eq 0 ]; then todo=1;fi
242 notdone=$(($todo - $(cat ${OUTPUT_DIR_BASENAME}/.tmp | wc -l))) 240 notdone=$(($todo - $(cat ${OUTPUT_DIR_BASENAME}/.tmp | wc -l)))
243 pourcentage=$((($notdone*100)/$todo)) 241 pourcentage=$((($notdone*100)/$todo))
244 if [ $notdone -ne 0 ] 242 if [ $notdone -ne 0 ]
245 then 243 then
246 print_error "[${BASENAME}] Check $ERRORFILE" 244 print_error "[${BASENAME}] Check $ERRORFILE"
247 print_log_file "$ERRORFILE" "ERROR : Treil not done [" 245 print_log_file "$ERRORFILE" "ERROR : Treil not done ["
248 diff ${PLP_LIST_P1} ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $ERRORFILE 246 diff ${PLP_LIST_P1} ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $ERRORFILE
249 print_log_file "$ERRORFILE" "] $pourcentage% $BASENAME" 247 print_log_file "$ERRORFILE" "] $pourcentage% $BASENAME"
250 else 248 else
251 print_log_file "$LOGFILE" "P3 OK $BASENAME | $(date +'%d/%m/%y %H:%M:%S')" 249 print_log_file "$LOGFILE" "P3 OK $BASENAME | $(date +'%d/%m/%y %H:%M:%S')"
252 fi 250 fi
253 rm ${OUTPUT_DIR_BASENAME}/.tmp > /dev/null 2>&1 251 rm ${OUTPUT_DIR_BASENAME}/.tmp > /dev/null 2>&1
254 fi 252 fi
255 253
256 #---------------# 254 #---------------#
257 # Convert res # 255 # Convert res #
258 #---------------# 256 #---------------#
259 257
260 print_info "[${BASENAME}] Convert .res into .ctm" 1 258 print_info "[${BASENAME}] Convert .res into .ctm" 1
261 # .res => .ctm 259 # .res => .ctm
262 $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format CTM --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.ctm 260 $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format CTM --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.ctm
263 print_info "[${BASENAME}] Convert .res into .trs" 1 261 print_info "[${BASENAME}] Convert .res into .trs" 1
264 # .res => .trs 262 # .res => .trs
265 echo -e "name $AUTHOR\nfileName ${BASENAME}\nfileExt wav\nsegFile ${OUTPUT_DIR_BASENAME}/${BASENAME}.seg" > ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg 263 echo -e "name $AUTHOR\nfileName ${BASENAME}\nfileExt wav\nsegFile ${OUTPUT_DIR_BASENAME}/${BASENAME}.seg" > ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg
266 $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 264 $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
267 rm ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg > /dev/null 2>&1 265 rm ${OUTPUT_DIR_BASENAME}/${BASENAME}.trs_cfg > /dev/null 2>&1
268 print_info "[${BASENAME}] Convert .res into .txt" 1 266 print_info "[${BASENAME}] Convert .res into .txt" 1
269 # .res => .txt 267 # .res => .txt
270 $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TXT --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.txt 268 $SCRIPT_PATH/res2out.pl --dir $RES_DIR --format TXT --ignore $RULES/asupp --out ${OUTPUT_DIR_BASENAME}/${BASENAME}.3pass.txt
271 269
272 270
273 print_info "[${BASENAME}] <= P3 End | $(date +'%d/%m/%y %H:%M:%S')" 1 271 print_info "[${BASENAME}] <= P3 End | $(date +'%d/%m/%y %H:%M:%S')" 1
274 272
275 # unlock directory 273 # unlock directory
276 mv "$OUTPUT_DIR_BASENAME/THIRDPASS.lock" "$OUTPUT_DIR_BASENAME/THIRDPASS.unlock" 274 mv "$OUTPUT_DIR_BASENAME/THIRDPASS.lock" "$OUTPUT_DIR_BASENAME/THIRDPASS.unlock"
277 275
278 276