Debian Codegraph @

3rdparty/flite_hts_engine/flite/lang/usenglish/usenglish.c

raw symbols SCIP
1 /*************************************************************************/
2 /* */
3 /* Language Technologies Institute */
4 /* Carnegie Mellon University */
5 /* Copyright (c) 2000 */
6 /* All Rights Reserved. */
7 /* */
8 /* Permission is hereby granted, free of charge, to use and distribute */
9 /* this software and its documentation without restriction, including */
10 /* without limitation the rights to use, copy, modify, merge, publish, */
11 /* distribute, sublicense, and/or sell copies of this work, and to */
12 /* permit persons to whom this work is furnished to do so, subject to */
13 /* the following conditions: */
14 /* 1. The code must retain the above copyright notice, this list of */
15 /* conditions and the following disclaimer. */
16 /* 2. Any modifications must be clearly marked as such. */
17 /* 3. Original authors' names are not deleted. */
18 /* 4. The authors' names are not used to endorse or promote products */
19 /* derived from this software without specific prior written */
20 /* permission. */
21 /* */
22 /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
23 /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
24 /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
25 /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
26 /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
27 /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
28 /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
29 /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
30 /* THIS SOFTWARE. */
31 /* */
32 /*************************************************************************/
33 /* Author: Alan W Black ([email protected]) */
34 /* Date: January 2001 */
35 /*************************************************************************/
36 /* Generic models for US English */
37 /*************************************************************************/
38
39 /* ----------------------------------------------------------------- */
40 /* The English TTS System "Flite+hts_engine" */
41 /* developed by HTS Working Group */
42 /* http://hts-engine.sourceforge.net/ */
43 /* ----------------------------------------------------------------- */
44 /* */
45 /* Copyright (c) 2005-2013 Nagoya Institute of Technology */
46 /* Department of Computer Science */
47 /* */
48 /* 2005-2008 Tokyo Institute of Technology */
49 /* Interdisciplinary Graduate School of */
50 /* Science and Engineering */
51 /* */
52 /* All rights reserved. */
53 /* */
54 /* Redistribution and use in source and binary forms, with or */
55 /* without modification, are permitted provided that the following */
56 /* conditions are met: */
57 /* */
58 /* - Redistributions of source code must retain the above copyright */
59 /* notice, this list of conditions and the following disclaimer. */
60 /* - Redistributions in binary form must reproduce the above */
61 /* copyright notice, this list of conditions and the following */
62 /* disclaimer in the documentation and/or other materials provided */
63 /* with the distribution. */
64 /* - Neither the name of the HTS working group nor the names of its */
65 /* contributors may be used to endorse or promote products derived */
66 /* from this software without specific prior written permission. */
67 /* */
68 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
69 /* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
70 /* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
71 /* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
72 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */
73 /* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
74 /* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
75 /* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
76 /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
77 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */
78 /* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */
79 /* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
80 /* POSSIBILITY OF SUCH DAMAGE. */
81 /* ----------------------------------------------------------------- */
82
83 #include "flite.h"
84 #include "usenglish.h"
85 #ifndef FLITE_PLUS_HTS_ENGINE
86 #include "us_f0.h"
87 #endif /* !FLITE_PLUS_HTS_ENGINE */
88 #include "us_text.h"
89 #include "us_ffeatures.h"
90
91 static const char * const us_english_punctuation = "\"'`.,:;!?(){}[]";
92 static const char * const us_english_prepunctuation = "\"'`({[";
93 static const char * const us_english_singlecharsymbols = "";
94 static const char * const us_english_whitespace = " \t\n\r";
95
96 void usenglish_init(cst_voice *v)
97 {
98 us_text_init();
99
100 /* utterance break function */
101 feat_set(v->features,"utt_break",breakfunc_val(&default_utt_break));
102
103 /* Phoneset */
104 feat_set(v->features,"phoneset",phoneset_val(&us_phoneset));
105 feat_set_string(v->features,"silence",us_phoneset.silence);
106
107 /* Text analyser */
108 feat_set_string(v->features,"text_whitespace",us_english_whitespace);
109 feat_set_string(v->features,"text_postpunctuation",us_english_punctuation);
110 feat_set_string(v->features,"text_prepunctuation",
111 us_english_prepunctuation);
112 feat_set_string(v->features,"text_singlecharsymbols",
113 us_english_singlecharsymbols);
114
115 feat_set(v->features,"tokentowords_func",itemfunc_val(&us_tokentowords));
116
117 /* very simple POS tagger */
118 feat_set(v->features,"pos_tagger_cart",cart_val(&us_pos_cart));
119
120 /* Phrasing */
121 feat_set(v->features,"phrasing_cart",cart_val(&us_phrasing_cart));
122
123 /* Intonation */
124 feat_set(v->features,"int_cart_accents",cart_val(&us_int_accent_cart));
125 feat_set(v->features,"int_cart_tones",cart_val(&us_int_tone_cart));
126
127 #ifndef FLITE_PLUS_HTS_ENGINE
128 /* Duration */
129 feat_set(v->features,"dur_cart",cart_val(&us_durz_cart));
130 feat_set(v->features,"dur_stats",dur_stats_val((dur_stats *)us_dur_stats));
131
132 /* f0 model */
133 feat_set(v->features,"f0_model_func",uttfunc_val(&us_f0_model));
134 #endif /* !FLITE_PLUS_HTS_ENGINE */
135
136 us_ff_register(v->ffunctions);
137 }