Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifndef __MDEF_H__
00051 #define __MDEF_H__
00052
00053
00054
00055 #include <stdio.h>
00056
00057
00058 #include <hash_table.h>
00059
00060 #ifdef __cplusplus
00061 extern "C" {
00062 #endif
00063 #if 0
00064 }
00065 #endif
00066
00075 typedef enum {
00076 WORD_POSN_INTERNAL = 0,
00077 WORD_POSN_BEGIN = 1,
00078 WORD_POSN_END = 2,
00079 WORD_POSN_SINGLE = 3,
00080 WORD_POSN_UNDEFINED = 4
00081 } word_posn_t;
00082 #define N_WORD_POSN 4
00083 #define WPOS_NAME "ibesu"
00084 #define S3_SILENCE_CIPHONE "SIL"
00090 typedef struct {
00091 char *name;
00092 int32 filler;
00094 } ciphone_t;
00095
00100 typedef struct {
00101 int32 ssid;
00104 int32 tmat;
00105 int16 ci, lc, rc;
00106 word_posn_t wpos;
00107 int16 *state;
00109 } phone_t;
00110
00116 typedef struct ph_rc_s {
00117 int16 rc;
00118 int32 pid;
00119 struct ph_rc_s *next;
00120 } ph_rc_t;
00121
00127 typedef struct ph_lc_s {
00128 int16 lc;
00129 ph_rc_t *rclist;
00130 struct ph_lc_s *next;
00131 } ph_lc_t;
00132
00133
00139 typedef struct {
00140 int32 n_ciphone;
00141 int32 n_phone;
00142 int32 n_emit_state;
00143 int32 n_ci_sen;
00144 int32 n_sen;
00145 int32 n_tmat;
00147 hash_table_t *ciphone_ht;
00148 ciphone_t *ciphone;
00149 phone_t *phone;
00150 int16 **sseq;
00152 int32 n_sseq;
00154 int16 *cd2cisen;
00157 int16 *sen2cimap;
00159 int16 sil;
00161 ph_lc_t ***wpos_ci_lclist;
00167 int16 *st2senmap;
00172 } mdef_t;
00173
00175 #define mdef_is_fillerphone(m,p) ((m)->ciphone[p].filler)
00176 #define mdef_n_ciphone(m) ((m)->n_ciphone)
00177 #define mdef_n_phone(m) ((m)->n_phone)
00178 #define mdef_n_sseq(m) ((m)->n_sseq)
00179 #define mdef_n_emit_state(m) ((m)->n_emit_state)
00180 #define mdef_n_sen(m) ((m)->n_sen)
00181 #define mdef_n_tmat(m) ((m)->n_tmat)
00182 #define mdef_pid2ssid(m,p) ((m)->phone[p].ssid)
00183 #define mdef_pid2tmatid(m,p) ((m)->phone[p].tmat)
00184 #define mdef_silphone(m) ((m)->sil)
00185 #define mdef_sen2cimap(m) ((m)->sen2cimap)
00186 #define mdef_sseq2sen(m,ss,pos) ((m)->sseq[ss][pos])
00187 #define mdef_pid2ci(m,p) ((m)->phone[p].ci)
00188 #define mdef_cd2cisen(m) ((m)->cd2cisen)
00189
00195 mdef_t *mdef_init (char *mdeffile,
00196 int breport
00197 );
00198
00199
00204 int mdef_ciphone_id(mdef_t *m,
00205 char *ciphone
00206 );
00207
00212 const char *mdef_ciphone_str(mdef_t *m,
00213 int ci
00214 );
00215
00220 int mdef_is_ciphone (mdef_t *m,
00221 int p
00222 );
00223
00228 int mdef_is_cisenone(mdef_t *m,
00229 int s
00230 );
00231
00236 int mdef_phone_id (mdef_t *m,
00237 int b,
00238 int l,
00239 int r,
00240 word_posn_t pos
00241 );
00242
00247 int mdef_phone_str(mdef_t *m,
00248 int pid,
00249 char *buf
00250 );
00251
00257 int mdef_hmm_cmp (mdef_t *m,
00258 int p1,
00259 int p2
00260 );
00261
00263 void mdef_report(mdef_t *m
00264 );
00265
00267 void mdef_free_recursive_lc (ph_lc_t *lc
00268 );
00269 void mdef_free_recursive_rc (ph_rc_t *rc
00270 );
00271
00273 void mdef_free (mdef_t *mdef
00274 );
00275
00276
00277 #if 0
00278 {
00279 #endif
00280 #ifdef __cplusplus
00281 }
00282 #endif
00283
00284 #endif