// file: $isip/class/search/SearchLevel/slev_00.cc // version: $Id: slev_00.cc 10675 2009-07-21 01:13:30Z tm334 $ // // isip include files // #include "SearchLevel.h" // method: destructor // // arguments: none // // return: none // // this is the default destructor for the SearchLevel class. // SearchLevel::~SearchLevel() { } // 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_symbol_graph_d = DEF_USE_SYMBOL_GRAPH; history_paths_d = DEF_HISTORY_PATHS; 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; use_rescore_d = DEF_RESCORE_MODE; use_acoustic_score_d = DEF_USE_ACOUSTIC_SCORE; acoustic_scale_d = DEF_ACOUSTIC_SCALE; 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 // bool8 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_symbol_graph_d = copy_level_a.use_symbol_graph_d; history_paths_d = copy_level_a.history_paths_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; use_rescore_d = copy_level_a.use_rescore_d; use_acoustic_score_d = copy_level_a.use_acoustic_score_d; acoustic_scale_d = copy_level_a.acoustic_scale_d; level_tag_d = copy_level_a.level_tag_d; // copy all internal data structures // if (!symbol_table_d.assign(copy_level_a.symbol_table_d)) { return false; } if (!nonspeech_boundary_symbol_table_d.assign(copy_level_a.nonspeech_boundary_symbol_table_d)) { return false; } if (!nonspeech_internal_symbol_table_d.assign(copy_level_a.nonspeech_internal_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 (!nsymbol_exclude_symbol_table_d.assign(copy_level_a.nsymbol_exclude_symbol_table_d)) { return false; } if (!spenalty_exclude_symbol_table_d.assign(copy_level_a.spenalty_exclude_symbol_table_d)) { return false; } if (!non_adapt_symbol_table_d.assign(copy_level_a.non_adapt_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; } // // debug by Tao // // // sub_graphs_d.assign(copy_level_a.sub_graphs_d); // Console::put(L"sub_graphs_d"); if (!tmp_graphs_d.assign(copy_level_a.tmp_graphs_d)) { return false; } if (!convertDigraphs()) { 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 bool8 value indicating status // // clear the contents of the search level // bool8 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_symbol_graph_d = DEF_USE_SYMBOL_GRAPH; history_paths_d = DEF_HISTORY_PATHS; 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; use_rescore_d = DEF_RESCORE_MODE; use_acoustic_score_d = DEF_USE_ACOUSTIC_SCORE; acoustic_scale_d = DEF_ACOUSTIC_SCALE; // clear the data structures // symbol_table_d.clear(cmode_a); context_hash_d.clear(cmode_a); nsymbol_model_d.clear(cmode_a); nonspeech_boundary_symbol_table_d.clear(cmode_a); nonspeech_internal_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); nsymbol_exclude_symbol_table_d.clear(cmode_a); spenalty_exclude_symbol_table_d.clear(cmode_a); non_adapt_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 // int32 num_graphs = sub_graphs_d.length(); for (int32 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_INDEX(L"level_index"); const String SearchLevel::PARAM_LEVEL_TAG(L"search_tag"); const String SearchLevel::PARAM_SYMBOL(L"search_symbols"); const String SearchLevel::PARAM_NONSPEECH_BOUNDARY_SYMBOL(L"search_non_speech_boundary_symbols"); const String SearchLevel::PARAM_NONSPEECH_INTERNAL_SYMBOL(L"search_non_speech_internal_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_NSYMBOL_EXCLUDE_SYMBOL(L"search_nsymbol_exclude_symbols"); const String SearchLevel::PARAM_SPENALTY_EXCLUDE_SYMBOL(L"search_spenalty_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_SYMBOL_GRAPH(L"use_symbol_graph"); const String SearchLevel::PARAM_HISTORY_PATHS(L"history_paths"); const String SearchLevel::PARAM_USE_ACOUSTIC_SCORE(L"use_acoustic_score"); const String SearchLevel::PARAM_ACOUSTIC_SCALE(L"ac_scale"); 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"); const String SearchLevel::PARAM_NON_ADAPT_SYMBOL(L"non_adapt_symbols"); // 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