/**************************************************************************/ /* File: hmm_state.h */ /**************************************************************************/ /* Project: Continuous Speech Recognition Search Algorithms */ /* Author: Neeraj Deshmukh, Aravind Ganapathiraju */ /* Class: EE 8993 Spring 1996 Date: March 12, 1996 */ /**************************************************************************/ /*======================================================================== This file declares the HMM state class that models the various phonemes (triphones) for the EE 8993 speech recognizer ========================================================================*/ /*------------------------------------------------------------------------ make sure definitions are only made once ------------------------------------------------------------------------*/ #ifndef __ISIP_HMM_STATE #define __ISIP_HMM_STATE /*------------------------------------------------------------------------ system and ISIP include files ------------------------------------------------------------------------*/ #include "hmm_matrix.h" #include "linked_list.h" #include /*------------------------------------------------------------------------ forward declaration of classes ------------------------------------------------------------------------*/ class HMM_Matrix; class HMM_Trans_State; class Linked_List; class HMM_State; /*------------------------------------------------------------------------ forward declaration of constants ------------------------------------------------------------------------*/ #define SEED_SELF_TRANS_SCORE 0.1 #define SEED_NEXT_TRANS_SCORE 0.9 #define MIN_SCORE 0.00001 /*======================================================================== HMM_State class definition for the states of an HMM ========================================================================*/ class HMM_State : public Linked_List{ // members // protected: /*-------------------------------- elements of the state transition --------------------------------*/ float_4 init_state_prob_d; /*---------------------------- elements of the state output ----------------------------*/ String out_symbol_d; /*------------------------- elements of the state pdf -------------------------*/ HMM_Matrix **mean_vector_ptr; HMM_Matrix **covar_matrix_ptr; int_2 num_mixtures_d; float_4 *coeff_mixtures_d; // methods // public: /*--------------------------- constructors and destructor ---------------------------*/ // default constructor // HMM_State (HMM_Trans_State *trans_ptr = NULL, HMM_Matrix **mean_vec_l = NULL, HMM_Matrix **covar_mat_l = NULL, int_2 num_mix_l = 1, String out_name = ""); // destructor // ~HMM_State (); /*--------------------------------------- input / output methods including scoring ----------------------------------------*/ float_8 get_trans_prob_cc (String trans_state_name); void add_trans_state_cc (HMM_State *next_state_l, float_8 score); void set_out_symbol_cc (String out_name_l); String get_out_symbol_cc (); HMM_Trans_State *get_transition_cc(); float_4 state_score_cc (HMM_Matrix *test_vector_l); // mixture related operations // void set_num_mix_cc (int_2 num_mix_l); int_2 get_num_mix_cc (); /*------------------------------ parameter reestimation methods ------------------------------*/ void update_mean_cc (HMM_Matrix **update_mean_l); void update_covariance_cc (HMM_Matrix **update_covar_l); void update_mix_weights_cc (float_4 *update_wts_l); HMM_Matrix **get_mean_cc (); HMM_Matrix **get_covar_cc (); /*------------------------- state linked list methods -------------------------*/ HMM_State *get_next_state_cc (); HMM_State *get_prev_state_cc (); HMM_State *add_state_cc (String state_name, HMM_Trans_State *trans_ptr = NULL); HMM_State *find_state_cc (String state_name); }; /*======================================================================== Trans_State class definition for the state transitions of the grammar derived from the generic linked list class ========================================================================*/ class HMM_Trans_State : public Linked_List { // members // protected: float_8 trans_prob_d; // methods // public: /*-------------------------- constructor and destructor --------------------------*/ HMM_Trans_State (HMM_State *state_ptr = NULL, float_8 score = 0); ~HMM_Trans_State (); /*---------------------- input / output methods ----------------------*/ String get_state_name_cc (); float_8 get_transition_score_cc (String trans_state_name = NULL); /*------------------------------------ state transition linked list methods ------------------------------------*/ HMM_Trans_State *get_next_transition_cc (); HMM_Trans_State *get_prev_transition_cc (); HMM_Trans_State *find_transition_cc (String trans_state_name); HMM_Trans_State *add_transition_state_cc (HMM_State *state_ptr, float_8 score); }; #endif