00001
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef __SENT_HMM_NEW2_H__
00034 #define __SENT_HMM_NEW2_H__
00035
00036 #include <sent/stddefs.h>
00037 #include <sent/htk_hmm.h>
00038 #include <sent/htk_param.h>
00039
00041 typedef struct _a_cell {
00042 LOGPROB a;
00043 int arc;
00044 struct _a_cell *next;
00045 } A_CELL;
00046
00048 typedef struct {
00049 A_CELL *ac;
00050
00067 union {
00068 HTK_HMM_State *state;
00069 CD_State_Set *cdset;
00070 } out;
00071 boolean is_pseudo_state;
00072 } HMM_STATE;
00073
00080 typedef struct {
00081 int len;
00082 HMM_STATE *state;
00083 #ifndef MULTIPATH_VERSION
00084 LOGPROB accept_ac_a;
00085 #endif
00086 } HMM;
00087
00088
00093 typedef struct _seg_token {
00094 int last_id;
00095 int last_end_frame;
00096 LOGPROB last_end_score;
00097 struct _seg_token *next;
00098 struct _seg_token *list;
00099 } SEGTOKEN;
00100
00101
00102
00103 HMM *new_make_word_hmm(HTK_HMM_INFO *, HMM_Logical **, int
00104 #ifdef MULTIPATH_VERSION
00105 , boolean *
00106 #endif
00107 );
00108 HMM *new_make_word_hmm_with_lm(HTK_HMM_INFO *, HMM_Logical **, int
00109 #ifdef MULTIPATH_VERSION
00110 , boolean *
00111 #endif
00112 , LOGPROB *);
00113 void free_hmm(HMM *);
00114
00115 LOGPROB viterbi_segment(HMM *hmm, HTK_Param *param, int *endstates, int ulen, int **id_ret, int **seg_ret, LOGPROB **uscore_ret, int *retlen);
00116
00117
00118 void make_log_tbl();
00119 LOGPROB addlog(LOGPROB x, LOGPROB y);
00120 LOGPROB addlog_array(LOGPROB *x, int n);
00121
00122
00123 boolean
00124 outprob_init(HTK_HMM_INFO *hmminfo,
00125 HTK_HMM_INFO *gshmm, int gms_num,
00126 int gprune_method, int gprune_mixnum
00127 );
00128 boolean outprob_prepare(int framenum);
00129 void outprob_free();
00130
00131 boolean outprob_cache_init();
00132 boolean outprob_cache_prepare();
00133 void outprob_cache_free();
00134 LOGPROB outprob_state(int t, HTK_HMM_State *stateinfo, HTK_Param *param);
00135 void outprob_cd_nbest_init(int num);
00136 void outprob_cd_nbest_free();
00137 LOGPROB outprob_cd(int t, CD_State_Set *lset, HTK_Param *param);
00138 LOGPROB outprob(int t, HMM_STATE *hmmstate, HTK_Param *param);
00139
00140 boolean gms_init(int nbest);
00141 boolean gms_prepare(int framelen);
00142 void gms_free();
00143 LOGPROB gms_state();
00144
00145 void gms_gprune_init(HTK_HMM_INFO *hmminfo, int gsset_num);
00146 void gms_gprune_prepare();
00147 void gms_gprune_free();
00148 void compute_gs_scores(GS_SET *gsset, int gsset_num, LOGPROB *scores_ret);
00149
00150
00151 LOGPROB calc_mix();
00152
00153 boolean calc_tied_mix_init();
00154 boolean calc_tied_mix_prepare(int framenum);
00155 void calc_tied_mix_free();
00156 LOGPROB calc_tied_mix();
00157
00158
00159 void put_hmm_arc(HMM *d);
00160 void put_hmm_outprob(HMM *d);
00161 void put_hmm(HMM *d);
00162
00163 #endif