📄 lex_tree.h
字号:
// file: lex_tree.h//// this is the header file for the lexical tree class//// make sure definitions are only made once//#ifndef __ISIP_LEX_TREE#define __ISIP_LEX_TREE// isip include files//#ifndef __ISIP_INTEGRAL#include <integral.h>#endif#ifndef __ISIP_LEX_NODE#include <lex_node.h>#endif#ifndef __ISIP_LINK_LIST#include <link_list.h>#endif#ifndef __ISIP_LATTICE_NODE#include <lattice_node.h>#endif#ifndef __ISIP_NGRAM#include <ngram.h>#endif#ifndef __ISIP_WORD#include <word.h>#endif#ifndef __ISIP_HASH_TABLE#include <hash_table.h>#endif// Lex_tree: a class that holds a lexical tree//class Lex_tree { //--------------------------------------------------------------------------- // // protected data // //---------------------------------------------------------------------------protected: // the word-history for this lexical tree // void_p history_d; // the start node for the tree // Lex_node* head_d; // flag to indicate active status // logical_1 status_d; //--------------------------------------------------------------------------- // // public methods // //---------------------------------------------------------------------------public: // required methods // char_1* name_cc(); volatile void error_handler_cc(char_1* method_name, char_1* message); logical_1 debug_cc(FILE *fp, char_1* message); int_4 size_cc(); // destructors/constructors // ~Lex_tree(); Lex_tree(); // default Lex_tree(void_p history); // overloaded Lex_tree(Lex_tree& tree); // copy // set data access methods // logical_1 set_history_cc(void_p history) { history_d = history; return ISIP_TRUE; } logical_1 set_head_cc(Lex_node* node) { head_d = node; return ISIP_TRUE; } logical_1 set_status_cc(logical_1 status) { status_d = status; return ISIP_TRUE; } // get data access methods // void_p get_history_cc() { return history_d; } Lex_node* get_head_cc() { return head_d; } logical_1 get_status_cc() { return status_d; } // setting up the tree from a lattice node // logical_1 build_tree_cc(Lattice_node* lat_node, float_4 score); // setting up a tree for all words in the grammar // logical_1 build_tree_cc(Ngram* ngram, Hash_table* lexicon); // setting up a tree for a list of specific words // logical_1 build_tree_cc(int_4 num, Ngram_node** ngmnodes); // count the number of nodes in the tree // int_4 num_lexnodes_cc(); //--------------------------------------------------------------------------- // // private methods // //---------------------------------------------------------------------------private: // handle the null lattice nodes in building the tree // logical_1 grow_tree_cc(Lattice_node* ltn, float_4 score, int_4 index); };// end of file// #endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -