lts.h

Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
00002 /*************************************************************************/
00003 /*                                                                       */
00004 /*                  Language Technologies Institute                      */
00005 /*                     Carnegie Mellon University                        */
00006 /*                        Copyright (c) 1999                             */
00007 /*                        All Rights Reserved.                           */
00008 /*                                                                       */
00009 /*  Permission is hereby granted, free of charge, to use and distribute  */
00010 /*  this software and its documentation without restriction, including   */
00011 /*  without limitation the rights to use, copy, modify, merge, publish,  */
00012 /*  distribute, sublicense, and/or sell copies of this work, and to      */
00013 /*  permit persons to whom this work is furnished to do so, subject to   */
00014 /*  the following conditions:                                            */
00015 /*   1. The code must retain the above copyright notice, this list of    */
00016 /*      conditions and the following disclaimer.                         */
00017 /*   2. Any modifications must be clearly marked as such.                */
00018 /*   3. Original authors' names are not deleted.                         */
00019 /*   4. The authors' names are not used to endorse or promote products   */
00020 /*      derived from this software without specific prior written        */
00021 /*      permission.                                                      */
00022 /*                                                                       */
00023 /*  CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK         */
00024 /*  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING      */
00025 /*  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT   */
00026 /*  SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE      */
00027 /*  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    */
00028 /*  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   */
00029 /*  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,          */
00030 /*  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF       */
00031 /*  THIS SOFTWARE.                                                       */
00032 /*                                                                       */
00033 /*************************************************************************/
00034 /*             Author:  Alan W Black (awb@cs.cmu.edu)                    */
00035 /*               Date:  December 1999                                    */
00036 /*************************************************************************/
00037 /*                                                                       */
00038 /*  Letter to sound rules                                                */
00039 /*                                                                       */
00040 /*************************************************************************/
00041 
00042 /*
00043  * lts.h -- Letter to sound rule support 
00044  * 
00045  * $Log$
00046  * Revision 1.1  2006/04/05  20:27:30  dhdfu
00047  * A Great Reorganzation of header files and executables
00048  * 
00049  * Revision 1.2  2006/02/22 20:44:17  arthchan2003
00050  * Merged from branch SPHINX3_5_2_RCI_IRII_BRANCH: As we have done in SphinxTrain and with the permission of flite developer. check in the routines for using LTS. In dict.c, one will see detail comment on how it was used and how we avoid problematic conditions.
00051  *
00052  * Revision 1.1.2.1  2005/09/25 19:07:52  arthchan2003
00053  * Added LTS rules and the module to use it.
00054  *
00055  *
00056  */
00057 
00058 #ifndef _CST_LTS_H__
00059 #define _CST_LTS_H__
00060 
00061 #include <s3types.h>
00062 
00063 
00064 #ifdef __cplusplus
00065 extern "C" {
00066 #endif
00067 #if 0
00068 /* Fool Emacs. */
00069 }
00070 #endif
00071 
00072 typedef unsigned short cst_lts_addr;
00073 typedef int cst_lts_phone;
00074 typedef unsigned char  cst_lts_feat;
00075 typedef unsigned char  cst_lts_letter;
00076 typedef unsigned char  cst_lts_model;
00077 
00078 /* end of rule value */
00079 #define CST_LTS_EOR 255
00080 
00081 /*
00082  */
00083 typedef uint32 acmod_id_t;
00084 typedef uint32 word_id_t;
00085 
00086 typedef struct lex_entry_str {
00087     char *ortho;
00088     word_id_t word_id;
00089     char **phone;
00090     acmod_id_t *ci_acmod_id;
00091     uint32  phone_cnt;
00092 
00093     struct lex_entry_str *next;
00094 } lex_entry_t;
00095 
00096 typedef struct cst_lts_rules_struct {
00097     char *name; 
00098     const cst_lts_addr *letter_index;  
00099     const cst_lts_model *models;
00100     const char * const * phone_table; 
00101     int context_window_size;
00102     int context_extra_feats;
00103     const char * const * letter_table;
00104 } cst_lts_rules;
00105 /* For Sphinx naming conventions. */
00106 typedef struct cst_lts_rules_struct lts_t;
00107 
00108 /* \struct cst_lts_rule
00109    
00110 */
00111 typedef struct cst_lts_rule_struct {
00112     cst_lts_feat   feat;
00113     cst_lts_letter val;
00114     cst_lts_addr   qtrue;
00115     cst_lts_addr   qfalse;
00116 } cst_lts_rule;
00117 typedef struct cst_lts_rule_struct lts_rule_t;
00118 
00119 struct lex_entry_str; /* This is actually lex_entry_t */
00120 cst_lts_rules *new_lts_rules(void);
00121 int lts_apply(const char *word,const char *feats,
00122               const cst_lts_rules *r, struct lex_entry_str *out_phones);
00123 
00127 void lex_print(lex_entry_t *ent 
00128     );
00129 
00130 extern const cst_lts_rules cmu6_lts_rules;
00131 
00132 #ifdef __cplusplus
00133 }
00134 #endif
00135 
00136 
00137 #endif
00138 

Generated on 7 Mar 2010 by  doxygen 1.6.1