1#!/bin/sh 2#####################################################-*-mode:shell-script-*- 3## ## 4## Language Technologies Institute ## 5## Carnegie Mellon University ## 6## Copyright (c) 2002 ## 7## All Rights Reserved. ## 8## ## 9## Permission is hereby granted, free of charge, to use and distribute ## 10## this software and its documentation without restriction, including ## 11## without limitation the rights to use, copy, modify, merge, publish, ## 12## distribute, sublicense, and/or sell copies of this work, and to ## 13## permit persons to whom this work is furnished to do so, subject to ## 14## the following conditions: ## 15## 1. The code must retain the above copyright notice, this list of ## 16## conditions and the following disclaimer. ## 17## 2. Any modifications must be clearly marked as such. ## 18## 3. Original authors' names are not deleted. ## 19## 4. The authors' names are not used to endorse or promote products ## 20## derived from this software without specific prior written ## 21## permission. ## 22## ## 23## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 24## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 25## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 26## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 27## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 28## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 29## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 30## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 31## THIS SOFTWARE. ## 32## ## 33########################################################################### 34## ## 35## Run SphinxTrain on data to build acoustic models then label it ## 36## with forced alignment ## 37## ## 38########################################################################### 39 40. etc/voice.defs 41 42if [ ! "$ESTDIR" ] 43then 44 echo "environment variable ESTDIR is unset" 45 echo "set it to your local speech tools directory e.g." 46 echo ' bash$ export ESTDIR=/home/awb/projects/speech_tools/' 47 echo or 48 echo ' csh% setenv ESTDIR /home/awb/projects/speech_tools/' 49 exit 1 50fi 51 52if [ ! "$SPHINXTRAINDIR" ] 53then 54 echo "environment variable SPHINXTRAINDIR is unset" 55 echo "set it to your local SphinxTrain src directory e.g." 56 echo ' bash$ export SPHINXTRAINDIR=/home/awb/projects/SphinxTrain/' 57 echo or 58 echo ' csh% setenv SPHINXTRAINDIR /home/awb/projects/SphinxTrain/' 59 exit 1 60fi 61 62if [ ! "$SPHINX2DIR" ] 63then 64 echo "environment variable SPHINX2DIR is unset" 65 echo "set it to your local Sphinx2 is installed e.g." 66 echo ' bash$ export SPHINX2DIR=/home/awb/projects/sphinx2/' 67 echo or 68 echo ' csh% setenv SPHINX2DIR /home/awb/projects/sphinx2/' 69 echo 'such that $SPHINX2DIR/bin/sphinx2-batch exists' 70 exit 1 71fi 72 73if [ $# = 0 ] 74then 75 $0 setup 76 $0 files 77 $0 feats 78 $0 train 79 $0 align 80 $0 labs 81 exit 82fi 83 84if [ "$1" = "setup" ] 85then 86 87 mkdir st 88 cd st 89 90 $SPHINXTRAINDIR/scripts_pl/setup_SphinxTrain $FV_VOICENAME 91 mkdir lab 92 93 cd .. 94fi 95 96# dic, fileids, phone, filler, transcription 97if [ "$1" = "files" ] 98then 99 festival -b festvox/build_st.scm '(st_setup "etc/txt.done.data" "'$FV_VOICENAME'")' 100fi 101 102# Wave 2 feats 103if [ "$1" = "feats" ] 104then 105 for i in wav/*.wav 106 do 107 $ESTDIR/bin/ch_wave -otype nist -o st/$i $i 108 done 109 (cd st; ./bin/make_feats etc/$FV_VOICENAME.fileids) 110fi 111 112if [ "$1" = "train" ] 113then 114 cd st 115 ./scripts_pl/00.verify/verify_all.pl 116 ./scripts_pl/01.vector_quantize/slave.VQ.pl 117 ./scripts_pl/02.ci_schmm/slave_convg.pl 118 ./scripts_pl/03.makeuntiedmdef/make_untied_mdef.pl 119 ./scripts_pl/04.cd_schmm_untied/slave_convg.pl 120 ./scripts_pl/05.buildtrees/make_questions.pl 121 ./scripts_pl/05.buildtrees/slave.treebuilder.pl 122 ./scripts_pl/06.prunetree/slave.state-tie-er.pl 123 ./scripts_pl/07.cd-schmm/slave_convg.pl 124 ./scripts_pl/08.deleted-interpolation/deleted_interpolation.pl 125 ./scripts_pl/09.make_s2_models/make_s2_models.pl 126 cd .. 127fi 128 129# Alignment 130if [ "$1" = "align" ] 131then 132 echo "*align_all*" >st/etc/$FV_VOICENAME.align 133 cat st/etc/$FV_VOICENAME.transcription | 134 sed 's/<sil>//g' | 135 awk '{for (i=2; i<NF-2; i++) 136 printf("%s ",$i); 137 printf("%s\n",$(NF-2))}' >>st/etc/$FV_VOICENAME.align 138 echo "<sil> SIL" >st/etc/$FV_VOICENAME.sil 139 ./bin/sphinx_lab 140fi 141 142# Copy back lab files 143if [ "$1" = "labs" ] 144then 145 silence=`head -1 etc/mysilence` 146 for i in st/lab/*.lab 147 do 148 cat $i | sed 's/;.*$//;s/(.*$//' | 149 sed 's/SIL/'$silence'/;s/CAP//' | 150 awk '{if (NF == 3) 151 printf("%1.5f %s %s\n",0.012+$1,$2,$3); 152 else 153 print $0}' >lab/`basename $i` 154 done 155fi 156