Debian Codegraph @

tools/add_flite_feats

raw
1 #!/bin/sh
2 ###########################################################################
3 ## ##
4 ## Language Technologies Institute ##
5 ## Carnegie Mellon University ##
6 ## Copyright (c) 2014-2016 ##
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 ## After a voice is built and dumped as a .flitevox file for ##
36 ## distribution, add the feats to the file from ../etc/flite_feats ##
37 ## ##
38 ## $FLITEDIR/tools/add_flite_feats X.flitevox ../etc/voice.feats ##
39 ## ##
40 ## ../etc/voice.feats should look something like ##
41 ## ##
42 ## age 42 ##
43 ## gender male ##
44 ## variant Scots ##
45 ## ##
46 ## If ../COPYING exists, the content is added as the feature copyright ##
47 ## ##
48 ###########################################################################
49
50 export LANG=C
51
52 awk '{if (NF > 1) print $0}' $2 | sed 's/"/\\"/g' |
53 awk '{printf("$FLITEDIR/bin/flitevox_info -set %s -val \"",$1);
54 for (i=2; i<NF; i++)
55 printf("%s ",$i);
56 printf("%s\"\n",$NF);}' >do_feats
57
58 if [ -f ../COPYING ]
59 then
60 cat ../COPYING | sed 's/"/\\"/g' |
61 awk 'BEGIN {printf("$FLITEDIR/bin/flitevox_info -set copyright -val \"\n");}
62 { printf("%s\n",$0); }
63 END {printf("\"\n");}' >>do_feats
64 fi
65
66 cat do_feats | sed 's%info -set%info -voice '$1' -set%' >do_feats2
67
68 # Save the time on the flitevox file
69 touch -r $1 do_feats
70
71 sh ./do_feats2
72 $FLITEDIR/bin/flitevox_info -set build_date -val `tar cf - do_feats | tar tvf - | awk '{printf("%s_%s",$4,$5)}'` -voice $1
73
74 # Put the time back
75 touch -r do_feats $1
76 rm -f do_feats do_feats2
77
78 exit
79