📄 lattice_node.h
字号:
// file: lattice_node.h//// this is the header for the lattice node class//// make sure definitions are only made once//#ifndef __ISIP_LATTICE_NODE#define __ISIP_LATTICE_NODE// isip include files//#ifndef __ISIP_INTEGRAL#include <integral.h>#endif// forward declaration of classes//#ifndef __ISIP_LINK_LIST#include <link_list.h>#endif#ifndef __ISIP_WORD#include <word.h>#endifclass Lex_tree;// Lattice_node: a class that is used to store the word (or other// acoustic unit) end information in the lattice. it also contains// a list of all possible next nodes and all prev nodes leading to// this node//class Lattice_node { //--------------------------------------------------------------------------- // // protected data // //---------------------------------------------------------------------------protected: // node identity // int_4 node_index_d; // node index int_4 type_d; // word/model/state etc. Word* word_d; // word represented by the node int_4 pron_variant_d; // pronunciation variant d int_4 frame_d; // frame at which the item ended // node statistics // int_4 num_arcs_in_d; // number of incoming arcs int_4 num_arcs_out_d; // number of outgoing arcs // nodes connected to this node // Link_list* prev_nodes_d; // linked list of previous nodes Link_list* next_nodes_d; // linked list of following nodes // pointer to the corresponding lexical tree // Lex_tree* lex_tree_d; // acoustic and language model scores of words emanating from this // node // float_4* lm_scores_d; float_4* ac_scores_d; //--------------------------------------------------------------------------- // // 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 // ~Lattice_node(); // destructor Lattice_node(); // default constructor Lattice_node(int_4 node_index); // overloaded Lattice_node(Lattice_node& lat_node); // copy constructor // methods to set/get generic information // logical_1 set_type_cc(int_4 item_index); // type int_4 get_type_cc(); logical_1 set_word_cc(Word* word); // word Word* get_word_cc(); logical_1 set_pron_var_cc(int_4 pron_var); // pronunciation variant int_4 get_pron_var_cc(); logical_1 set_frame_index_cc(int_4 frame); // frame index int_4 get_frame_index_cc(); logical_1 set_node_index_cc(int_4 index); // node index int_4 get_node_index_cc(); // methods to set/get node statistics // logical_1 set_num_arcs_in_cc(int_4 num_arcs); // number of incoming arcs logical_1 incr_num_arcs_in_cc(); int_4 get_num_arcs_in_cc(); logical_1 set_num_arcs_out_cc(int_4 num_arcs); // number of outgoing arcs logical_1 incr_num_arcs_out_cc(); int_4 get_num_arcs_out_cc(); // methods to set/get list of nodes connected to this node // Link_list* get_prev_nodes_cc(); // prev nodes Link_list* get_next_nodes_cc(); // next nodes // methods to add a node to the prev/next nodes list // logical_1 add_prev_node_cc(Lattice_node* lat_node); logical_1 add_next_node_cc(Lattice_node* lat_node); // methods to set/get lexical tree // logical_1 set_lex_tree_cc(Lex_tree* tree); Lex_tree* get_lex_tree_cc(); // methods to handle lm scores // float_4* get_lm_scores_cc(); // get the array containing the LM scores logical_1 add_lm_score_cc(float_4 lm_score); // add a score to the array float_4 get_lmscore_cc(Lattice_node* lnode); // lm score for specific arc logical_1 replace_lm_score_cc(float_4 lm_score, int_4 index); // replace score of specific arc // methods to handle acoustic scores // float_4* get_ac_scores_cc(); // get the array containing the acoustic scores logical_1 add_ac_score_cc(float_4 lm_score); // add a score to the array float_4 get_acscore_cc(Lattice_node* lnode); // ac score for specific arc // method to add a node to the next list of this node // logical_1 add_node_cc(Lattice_node* lat_node, float_4 lmscore, float_4 acscore, Lattice_node** lnode, int_4*& map_list, int_4& node_count, int_4& arc_count); logical_1 add_node_cc(Lattice_node* lat_node, Lattice_node** lnode, int_4*& map_list, int_4& node_count, int_4& arc_count); // method to clear the contents of the lattice node // logical_1 clear_cc(); //--------------------------------------------------------------------------- // // private methods // //---------------------------------------------------------------------------private:};// end of file// #endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -