usenglish.c 4.5 KB

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