📄 train_lattice.h
字号:
// file: train_lattice.h//// this is the header for the lattice class//// make sure definitions are only made once//#ifndef __ISIP_TRAIN_LATTICE#define __ISIP_TRAIN_LATTICE// isip include files//#ifndef __ISIP_INTEGRAL#include <integral.h>#endif// forward declaration of classes//#ifndef __ISIP_TRAIN_LINK_LIST#include <train_link_list.h>#endif#ifndef __ISIP_TRAIN_LATTICE_NODE#include <train_lattice_node.h>#endif#ifndef __ISIP_TRAIN_HASH_TABLE#include <train_hash_table.h>#endif// Train_Lattice: a class that is used to store the N-best word hypothesis// in the form of a word graph//class Train_Lattice { //--------------------------------------------------------------------------- // // protected data // //---------------------------------------------------------------------------protected: // node statistics // int_4 num_arcs_d; // number of arcs in the lattice int_4 num_nodes_d; // number of nodes in the lattice // node pointers // Train_Hash_table* lnode_d; // hash table of lattice nodes Train_Lattice_node* start_node_d; // start node of the lattice // lattice generation information // char_1* lang_model_d; // language model used for construction char_1* utterance_d; // utterance represented by the lattice char_1* model_set_d; // model set used for scoring acoustics // likelihood scale factors // float_4 lm_scale_d; // language model scale factor float_4 word_penalty_d; // word insertion penalty //--------------------------------------------------------------------------- // // public methods // //---------------------------------------------------------------------------public: // required methods // char_1* name_cc(); volatile void error_handler_cc(char_1* mname, char_1* msg); logical_1 debug_cc(FILE* fp, char_1* message); int_4 size_cc(); // destructors/constructors // ~Train_Lattice(); Train_Lattice(); Train_Lattice(int_4 num_nodes, int_4 num_arcs, Train_Hash_table* lnodes); Train_Lattice(Train_Lattice& lattice); // methods to set generic information // logical_1 set_num_arcs_cc(int_4 num_arcs); // number of arcs logical_1 set_num_nodes_cc(int_4 num_nodes); // number of nodes logical_1 set_lang_model_cc(char_1* lang_model_name); // language model logical_1 set_utterance_cc(char_1* utterance_name); // utterance logical_1 set_model_set_cc(char_1* model_set); // model set logical_1 set_word_penalty_cc(float_4 word_penalty); // word penalty logical_1 set_lm_scale_cc(float_4 lm_scale); // lm scale factor // methods to get generic information // int_4 get_num_arcs_cc(); // number of arcs int_4 get_num_nodes_cc(); // number of nodes logical_1 get_lang_model_cc(char_1*& lang_model); // language model logical_1 get_utterance_cc(char_1*& utterance); // utterance logical_1 get_model_set_cc(char_1*& model_set); // model set float_4 get_word_penalty_cc(); // word penalty float_4 get_lm_scale_cc(); // lm scale factor // methods to set/get start lattice node information // logical_1 set_start_node_cc(Train_Lattice_node* lat_node); Train_Lattice_node* get_start_node_cc(); // methods to set/get lattice node hash table information // logical_1 set_lnodes_cc(Train_Hash_table* lnodes); Train_Hash_table* get_lnodes_cc(); // method to set/get individual lattice nodes // logical_1 set_lat_node_cc(Train_Lattice_node* lnode); logical_1 get_lat_node_cc(Train_Lattice_node* lnode, Train_Hash_cell*& lcell); // read methods for lattice // logical_1 read_lattice_cc(FILE* fp_lattice, Train_Hash_table* words); logical_1 read_trans_cc(FILE* fp_trans, Train_Hash_table* words); // write methods for the lattice // logical_1 write_lattice_cc(FILE* fp_lattice); // method to reduce the original lattice to a more efficient format // logical_1 reduce_lattice_cc(Train_Lattice*& new_lattice); // dynamic programming based lattice error computation for the utterance // logical_1 error_rate_cc(char_1* utterance, int_4 num_subs, int_4 num_dels, int_4 num_ins); // re-assign the node indices // logical_1 index_nodes_cc(); //--------------------------------------------------------------------------- // // private methods // //---------------------------------------------------------------------------private: // lattice building methods // logical_1 init_nodes_cc(Train_Lattice_node** lnodes); // arrange the lattice nodes in a hash table in order // logical_1 lat_arrange_cc(Train_Lattice_node**& lnodes); // update the node index // logical_1 update_index_cc(Train_Lattice_node* latnode, int_4* map, int_4& idx); };// end of file// #endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -