📄 slev_00.cc
字号:
// file: $isip/class/search/SearchLevel/slev_00.cc// version: $Id: slev_00.cc,v 1.24 2003/03/21 16:40:00 huang Exp $//// isip include files//#include "SearchLevel.h"// method: destructor//// arguments: none//// return: none//// this is the default destructor for the SearchLevel class.//SearchLevel::~SearchLevel() { //local variable // // set the memory allocation mode of each graph to be SYSTEM mode // to make the system take care of SearchNode deallocation // for (long i = 0; i < sub_graphs_d.length(); i++) { // loop through all graphs // sub_graphs_d(i).setAllocationMode(DstrBase::SYSTEM); }}// method: default constructor//// arguments: none//// return: none//// this is the default constructor for the SearchLevel class.//SearchLevel::SearchLevel() { // set all data to defaults // level_index_d = DEF_LEVEL_INDEX; use_beam_prune_d = DEF_BEAM_PRUNE; beam_threshold_d = DEF_BEAM_THRESHOLD; use_instance_prune_d = DEF_INSTANCE_PRUNE; instance_threshold_d = DEF_INSTANCE_THRESHOLD; use_context_d = DEF_USE_CONTEXT; use_lexical_tree_d = DEF_USE_LEXICAL_TREE; left_context_d = DEF_LEFT_CONTEXT; right_context_d = DEF_RIGHT_CONTEXT; use_nsymbol_d = DEF_USE_NSYMBOL; nsymbol_order_d = DEF_NSYMBOL_ORDER; lm_scale_d = DEF_LM_SCALE; tr_scale_d = DEF_TR_SCALE; symbol_penalty_d = DEF_SYMBOL_PENALTY; write_symbol_occupancy_d = DEF_WRITE_SYMBOL_OCCUPANCY; num_of_mixtures_d = DEF_NUM_OF_MIXTURES; stat_model_type_d = StatisticalModel::GAUSSIAN_MODEL;}// method: copy constructor//// arguments:// const SearchLevel& copy_level: (input) level to copy//// return: none//// this is the copy constructor for the SearchLevel class//SearchLevel::SearchLevel(const SearchLevel& copy_level_a) { assign(copy_level_a);}// method: assign//// arguments:// const SearchLevel& copy_level: (input) level to copy//// return: logical error status//// assign search level from the copy//boolean SearchLevel::assign(const SearchLevel& copy_level_a) { // copy all internal data elements // level_index_d = copy_level_a.level_index_d; use_beam_prune_d = copy_level_a.use_beam_prune_d; beam_threshold_d = copy_level_a.beam_threshold_d; use_instance_prune_d = copy_level_a.use_instance_prune_d; instance_threshold_d = copy_level_a.instance_threshold_d; use_context_d = copy_level_a.use_context_d; use_lexical_tree_d = copy_level_a.use_lexical_tree_d; left_context_d = copy_level_a.left_context_d; right_context_d = copy_level_a.right_context_d; use_nsymbol_d = copy_level_a.use_nsymbol_d; nsymbol_order_d = copy_level_a.nsymbol_order_d; lm_scale_d = copy_level_a.lm_scale_d; tr_scale_d = copy_level_a.tr_scale_d; symbol_penalty_d = copy_level_a.symbol_penalty_d; write_symbol_occupancy_d = copy_level_a.write_symbol_occupancy_d; num_of_mixtures_d = copy_level_a.num_of_mixtures_d ; stat_model_type_d = copy_level_a.stat_model_type_d; // copy all internal data structures // if (!symbol_table_d.assign(copy_level_a.symbol_table_d)) { return false; } if (!nonspeech_symbol_table_d.assign(copy_level_a.nonspeech_symbol_table_d)) { return false; } if (!contextless_symbol_table_d.assign(copy_level_a.contextless_symbol_table_d)) { return false; } if (!skip_symbol_table_d.assign(copy_level_a.skip_symbol_table_d)) { return false; } if (!dummy_symbol_table_d.assign(copy_level_a.dummy_symbol_table_d)) { return false; } if (!exclude_symbol_table_d.assign(copy_level_a.exclude_symbol_table_d)) { return false; } if (!symbol_hash_d.assign(copy_level_a.symbol_hash_d)) { return false; } if (!stat_models_d.assign(copy_level_a.stat_models_d)) { return false; } if (!sub_graphs_d.assign(copy_level_a.sub_graphs_d)) { return false; } if (!context_hash_d.assign(copy_level_a.context_hash_d)) { return false; } if (!nsymbol_model_d.assign(copy_level_a.nsymbol_model_d)) { return false; } if (!context_map_d.assign(copy_level_a.context_map_d)) { return false; } // copy the symbol occupancy filename // if (!symbol_occupancy_file_d.assign(copy_level_a.symbol_occupancy_file_d)) { return false; } // exit gracefully // return true;}// method: clear//// arguments:// Integral::CMODE cmode: (input) clear mode//// return: a boolean value indicating status//// clear the contents of the search level//boolean SearchLevel::clear(Integral::CMODE cmode_a) { if (cmode_a != Integral::RETAIN) { // set all data to defaults // level_index_d = DEF_LEVEL_INDEX; use_beam_prune_d = DEF_BEAM_PRUNE; beam_threshold_d = DEF_BEAM_THRESHOLD; use_instance_prune_d = DEF_INSTANCE_PRUNE; instance_threshold_d = DEF_INSTANCE_THRESHOLD; use_context_d = DEF_USE_CONTEXT; use_lexical_tree_d = DEF_USE_LEXICAL_TREE; left_context_d = DEF_LEFT_CONTEXT; right_context_d = DEF_RIGHT_CONTEXT; use_nsymbol_d = DEF_USE_NSYMBOL; nsymbol_order_d = DEF_NSYMBOL_ORDER; lm_scale_d = DEF_LM_SCALE; tr_scale_d = DEF_TR_SCALE; symbol_penalty_d = DEF_SYMBOL_PENALTY; write_symbol_occupancy_d = DEF_WRITE_SYMBOL_OCCUPANCY; num_of_mixtures_d = DEF_NUM_OF_MIXTURES; stat_model_type_d = StatisticalModel::GAUSSIAN_MODEL; // clear the data structures // symbol_table_d.clear(cmode_a); context_hash_d.clear(cmode_a); nsymbol_model_d.clear(cmode_a); nonspeech_symbol_table_d.clear(cmode_a); contextless_symbol_table_d.clear(cmode_a); skip_symbol_table_d.clear(cmode_a); dummy_symbol_table_d.clear(cmode_a); exclude_symbol_table_d.clear(cmode_a); stat_models_d.clear(cmode_a); symbol_hash_d.clear(cmode_a); nsymbol_model_d.clear(cmode_a); context_map_d.clear(cmode_a); // clear the symbol occupancy filename // symbol_occupancy_file_d.clear(cmode_a); } // clean sub graphs // long num_graphs = sub_graphs_d.length(); for (long i = 0 ; i < num_graphs; i++) { sub_graphs_d(i).clear(cmode_a); } // exit gracefully // return true;}// constants: class name//const String SearchLevel::CLASS_NAME(L"SearchLevel");// constants: i/o related constants//const String SearchLevel::DEF_PARAM(L"");const String SearchLevel::PARAM_DELIM1(L"-");const String SearchLevel::PARAM_DELIM2(L"+");const String SearchLevel::PARAM_DELIM3(L"+-");const String SearchLevel::PARAM_LEVEL_TAG(L"search_tag");const String SearchLevel::PARAM_SYMBOL(L"search_symbols");const String SearchLevel::PARAM_NUM_OF_MIXTURES(L"num_of_mixtures");const String SearchLevel::PARAM_STAT_MODEL_TYPE(L"stat_model_type");const String SearchLevel::PARAM_NONSPEECH_SYMBOL(L"search_non_speech_symbols");const String SearchLevel::PARAM_CONTEXTLESS_SYMBOL(L"search_no_context_symbols");const String SearchLevel::PARAM_SKIP_SYMBOL(L"search_skip_symbols");const String SearchLevel::PARAM_DUMMY_SYMBOL(L"search_dummy_symbols");const String SearchLevel::PARAM_EXCLUDE_SYMBOL(L"search_exclude_symbols");const String SearchLevel::PARAM_MODEL(L"search_models");const String SearchLevel::PARAM_STAT_HASH(L"symbol_hashtable");const String SearchLevel::PARAM_STAT(L"stat_models");const String SearchLevel::PARAM_STAT_OCCUPANCY(L"stat_occupancies");const String SearchLevel::PARAM_USE_BEAM(L"use_beam_pruning");const String SearchLevel::PARAM_BEAM_THRESHOLD(L"beam_threshold");const String SearchLevel::PARAM_USE_INSTANCE(L"use_instance_pruning");const String SearchLevel::PARAM_INSTANCE_THRESHOLD(L"instance_threshold");const String SearchLevel::PARAM_USE_NSYMBOL(L"use_nsymbol");const String SearchLevel::PARAM_NSYMBOL_ORDER(L"nsymbol_order");const String SearchLevel::PARAM_NSYMBOL_MODEL(L"nsymbol_model");const String SearchLevel::PARAM_SYMBOL_PENALTY(L"symbol_penalty");const String SearchLevel::PARAM_LM_SCALE(L"lm_scale");const String SearchLevel::PARAM_TR_SCALE(L"tr_scale");const String SearchLevel::PARAM_USE_CONTEXT(L"use_symbol_context");const String SearchLevel::PARAM_CONTEXT_MAPPING(L"context_mapping");const String SearchLevel::PARAM_USE_LEXICAL_TREE(L"use_lexical_tree");const String SearchLevel::PARAM_LEFT_CONTEXT_LENGTH(L"left_context_length");const String SearchLevel::PARAM_RIGHT_CONTEXT_LENGTH(L"right_context_length");const String SearchLevel::PARAM_WRITE_SYMBOL_OCCUPANCY(L"write_symbol_occupancy");const String SearchLevel::PARAM_SYMBOL_OCCUPANCY_FILE(L"symbol_occupancy_file");// static instantiations: memory manager and debug level//MemoryManager SearchLevel::mgr_d(sizeof(SearchLevel), name());Integral::DEBUG SearchLevel::debug_level_d = Integral::NONE;//// end of file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -