// file: init_triphones.h
//
// definitions file for the utility that initializes triphones using a
// clustered phone list and context-independent phones related material
//

// make sure definitions are made only once
//
#ifndef __ISIP_INIT_TRIPHONES
#define __ISIP_INIT_TRIPHONES

// isip include files
//
#ifndef __ISIP_INTEGRAL
#include <integral.h>
#endif

// forward declaration of classes
//
#ifndef __ISIP_TRAIN_STATE
#include <train_state.h>
#endif

#ifndef __ISIP_TRAIN_MODEL
#include <train_model.h>
#endif

#ifndef __ISIP_TRAIN_HASH_CELL
#include <train_hash_cell.h>
#endif

#ifndef __ISIP_TRAIN_HASH_TABLE
#include <train_hash_table.h>
#endif

#ifndef __ISIP_TRAIN_MEMORY_MANAGER
#include <train_memory_manager.h>
#endif

#ifndef __ISIP_TRAIN_LINK_LIST
#include <train_link_list.h>
#endif

// functions to decipher commandline
//
logical_1 read_cmdline_cc(int_4 argc, char_1** argv, char_1* in_file);

// computational functions
//
logical_1 create_triphones_cc(FILE* fp_in, FILE* fp_model, FILE* fp_state,
			      Train_Hash_table* models,
			      Train_Hash_table* ci_table, Train_Hash_table* trans_map,
			      int_4 num_ci, int_4& new_num_states,
			      int_4& new_num_models);

// i/o methods
//
// function to read parameter file
//
logical_1 read_params_cc(FILE* fp_param, char_1* in_models_file,
			 char_1* out_models_file, char_1* in_trans_file,
			 char_1* out_trans_file, char_1* in_states_file,
			 char_1* out_states_file, char_1* tri_clist_file,
			 char_1* ci_phones_file);

// functions to read states file
//
Train_State** read_states_cc(FILE* fp_state, int_4& num_states, int_4& num_features);

// function to read transitions file
//
float_4*** read_trans_cc(FILE* fp_trans, int_4& num_trans, int_4*& trans_size);

// function to read model file
//
Train_Hash_table* read_models_cc(FILE* fp_in, Train_State** states,
			   float_4*** transitions, Train_Hash_table*& trans_map,
			   int_4& num_models);

// read ci phones
//
Train_Hash_table* read_cimodels_cc(FILE* fp, int_4& num_mono);

// miscellaneous methods
//
logical_1 expand_filename_cc(char_1*& fname);
int_4 get_cimodel_cc(char_1* phy_model, Train_Hash_table* ci_table, int_4 num_ci,
		     char_1* ci_model);
logical_1 print_state_cc(FILE* fp_state, Train_State* state);

// end of file
//
#endif





