| 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 |
#include "flite.h" |
| 40 |
#include "usenglish.h" |
| 41 |
#include "us_f0.h" |
| 42 |
#include "us_text.h" |
| 43 |
#include "us_ffeatures.h" |
| 44 |
|
| 45 |
static const char * const us_english_punctuation = "\"'`.,:;!?(){}[]"; |
| 46 |
static const char * const us_english_prepunctuation = "\"'`({["; |
| 47 |
static const char * const us_english_singlecharsymbols = ""; |
| 48 |
static const char * const us_english_whitespace = " \t\n\r"; |
| 49 |
|
| 50 |
void usenglish_init(cst_voice *v) |
| 51 |
{ |
| 52 |
/* utterance break function */ |
| 53 |
feat_set(v->features,"utt_break",breakfunc_val(&default_utt_break)); |
| 54 |
|
| 55 |
/* Phoneset */ |
| 56 |
feat_set(v->features,"phoneset",phoneset_val(&us_phoneset)); |
| 57 |
feat_set_string(v->features,"silence",us_phoneset.silence); |
| 58 |
|
| 59 |
/* Text analyser */ |
| 60 |
feat_set_string(v->features,"text_whitespace",us_english_whitespace); |
| 61 |
feat_set_string(v->features,"text_postpunctuation",us_english_punctuation); |
| 62 |
feat_set_string(v->features,"text_prepunctuation", |
| 63 |
us_english_prepunctuation); |
| 64 |
feat_set_string(v->features,"text_singlecharsymbols", |
| 65 |
us_english_singlecharsymbols); |
| 66 |
|
| 67 |
feat_set(v->features,"tokentowords_func",itemfunc_val(&us_tokentowords)); |
| 68 |
|
| 69 |
/* very simple POS tagger */ |
| 70 |
feat_set(v->features,"pos_tagger_cart",cart_val(&us_pos_cart)); |
| 71 |
|
| 72 |
/* Phrasing */ |
| 73 |
feat_set(v->features,"phrasing_cart",cart_val(&us_phrasing_cart)); |
| 74 |
|
| 75 |
/* Intonation */ |
| 76 |
feat_set(v->features,"int_cart_accents",cart_val(&us_int_accent_cart)); |
| 77 |
feat_set(v->features,"int_cart_tones",cart_val(&us_int_tone_cart)); |
| 78 |
|
| 79 |
/* Duration */ |
| 80 |
feat_set(v->features,"dur_cart",cart_val(&us_durz_cart)); |
| 81 |
feat_set(v->features,"dur_stats",dur_stats_val((dur_stats *)us_dur_stats)); |
| 82 |
|
| 83 |
/* f0 model */ |
| 84 |
feat_set(v->features,"f0_model_func",uttfunc_val(&us_f0_model)); |
| 85 |
|
| 86 |
us_ff_register(v->ffunctions); |
| 87 |
} |