// file: $isip/class/pr/HiddenMarkovModel/HiddenMarkovModel.h // version: $Id: HiddenMarkovModel.h 10636 2007-01-26 22:18:09Z tm334 $ // // make sure definitions are only made once // #ifndef ISIP_HIDDEN_MARKOV_MODEL #define ISIP_HIDDEN_MARKOV_MODEL #ifndef ISIP_DOUBLE #include #endif #ifndef ISIP_ULONG #include #endif #ifndef ISIP_VECTOR_BYTE #include #endif #ifndef ISIP_MATRIX_FLOAT #include #endif #ifndef ISIP_FRONT_END #include #endif #ifndef ISIP_TRAIN_NODE #include #endif #ifndef ISIP_WRAPPER #include #endif #ifndef ISIP_HASH_KEY #include #endif #ifndef ISIP_LANGUAGE_MODEL #include #endif #ifndef ISIP_LANGUAGE_MODEL_IHD #include #endif #ifndef ISIP_HIERARCHICAL_SEARCH #include #endif #ifndef ISIP_STACK_SEARCH #include #endif #ifndef ISIP_TRANSCRIPTION_DATABASE #include #endif #ifndef ISIP_AUDIO_DATABASE #include #endif #ifndef ISIP_SYMBOL_GRAPH_DATABASE #include #endif #ifndef ISIP_ANNOTATION_GRAPH #include #endif #ifndef ISIP_ANNOTATION #include #endif #ifndef ISIP_NBEST_PATH #include #endif #ifndef ISIP_SDB #include #endif #ifndef ISIP_PHONETIC_DECISION_TREE #include #endif #ifndef ISIP_MAXIMUM_LIKELIHOOD_LINEAR_REGRESSION #include #endif #ifndef ISIP_ANNOTATION_GRAPH #include #endif // HiddenMarkovModel: an intermediate class providing base // for Decode and Train algorithm using // Viterbi or Baum-Welch implementation // class HiddenMarkovModel { //-------------------------------------------------------------------------- // // public constants // //-------------------------------------------------------------------------- public: // define the class name // static const String CLASS_NAME; //---------------------------------------- // // other important constants // //---------------------------------------- // define the algorithm choices // enum ALGORITHM { DECODE = 0, TRAIN, MODEL_CREATION, INITIALIZE, MIXTURE_SPLITTING, CONTEXT_GENERATION, TRAIN_PARAMETER_TYING, TEST_PARAMETER_TYING, FORCED_ALIGNMENT, MLLR, MAP, SYMBOL_GRAPH_GENERATION, SYMBOL_GRAPH_RESCORING, NBEST_GENERATION, DEF_ALGORITHM = DECODE }; // define the implementation choices // enum IMPLEMENTATION { VITERBI = 0, STACK, BAUM_WELCH, GLOBAL, VARIANCE_SPLITTING, SYMBOL_GENERATION, ML, MODEL_GENERATION, WORD_DEPENDENT_NBEST, VITERBI_NBEST, RESCORE_ACOUSTIC, RESCORE_LANGUAGE, RESCORE_BOTH, DEF_IMPLEMENTATION = VITERBI }; // define the context choices // enum CONTEXT_MODE { SYMBOL_ONLY = 0, SYMBOL_INTERNAL, CROSS_SYMBOL, DEF_CONTEXT_MODE = SYMBOL_ONLY }; // define the cross-word choices // enum FUNCTION_MODE { NONE = 0, GRAMMAR_DECODING, NETWORK_DECODING, ACCUMULATE, UPDATE, DEF_FUNCTION_MODE = NONE }; // define modes // enum MODE { FILE = 0, TRANSFORM, LIST, DATABASE, DEF_MODE = DATABASE }; // define update modes // enum UPDATE_MODE { TRANSITIONS = 0, OBSERVATIONS, ALL, DEF_UPDATE_MODE = ALL }; // define output formats // enum FORMAT { NIST_SCORE = 0, NATIVE, JSGF, IHD, XML, ABNF, BNF, SYMBOL_GRAPH, DEF_FORMAT = IHD }; // define output types // enum TYPE { TEXT = 0, BINARY, DEF_TYPE = BINARY }; // define internal on/off states // static const byte8 OFF = 0; static const byte8 ON = 1; // define internal default values // static const String DEF_TRANSCRIPTION_LEVEL; static const String DEF_SYMBOL_GRAPH_LEVEL; static const String DEF_FORCE_ALIGNMENT_LEVEL; // define internal constants // static const float32 DEF_WEIGTH_ONE = 0; static const float32 DEF_WEIGTH_HALF = -0.693147; static const float32 DEF_BETA_PRUNING_THRESHOLD = 3.40282347e+38F; static const float32 DEF_FLT_MIN = 1.17549435e-38F; static const float32 DEF_FLT_MAX = 3.40282347e+38F; static const float32 DEF_DBL_MIN = 2.2250738585072014e-308; static const float32 DEF_DBL_MAX = 1.7976931348623157e+308; // define the static NameMap objects // static const NameMap IMPL_MAP; static const NameMap ALGO_MAP; static const NameMap CONTEXT_MODE_MAP; static const NameMap FUNCTION_MODE_MAP; static const NameMap MODE_MAP; static const NameMap FORMAT_MAP; static const NameMap TYPE_MAP; static const NameMap UPDATE_MODE_MAP; //---------------------------------------- // // i/o related constants // //---------------------------------------- static const String DEF_PARAM; static const String PARAM_UPDATE_LEVELS; static const String PARAM_NUM_MIXTURES; static const String PARAM_NUM_ITERATIONS; static const String PARAM_VAR_FLOOR; static const String PARAM_VAR_FLOOR_FILE; static const String PARAM_BETA_THRESHOLD; static const String PARAM_TRANSCRIPTION_LEVEL; static const String PARAM_SYMBOL_GRAPH_LEVEL; static const String PARAM_FORCE_ALIGNMENT_LEVEL; static const String PARAM_TRANS_DB; static const String PARAM_AUDIO_DB; static const String PARAM_SYMBOL_GRAPH_DB; static const String PARAM_MIN_MPD; static const String PARAM_MIN_OCCUPANCY; static const String PARAM_MIN_MODEL_COUNT; static const String PARAM_ALGORITHM; static const String PARAM_IMPLEMENTATION; static const String PARAM_NBEST_PATHS; static const String PARAM_MAX_NBEST_PATHS; static const String PARAM_NBEST_BEAM; static const String PARAM_CONFIGURATION; static const String PARAM_FRONT_END; static const String PARAM_LANGUAGE_MODEL; static const String PARAM_STATISTICAL_MODEL_POOL; static const String PARAM_UPDATE_LANGUAGE_MODEL; static const String PARAM_UPDATE_STATISTICAL_MODEL_POOL; static const String PARAM_ACCUMULATOR; static const String PARAM_ACCUMULATOR_LIST; static const String PARAM_OUTPUT_MODE; static const String PARAM_OUTPUT_FORMAT; static const String PARAM_OUTPUT_TYPE; static const String PARAM_OUTPUT_LEVELS; static const String PARAM_UPDATE_MODE; static const String PARAM_FUNCTION_MODE; static const String PARAM_CONTEXT_MODE; static const String PARAM_CONTEXT_LEVEL; static const String PARAM_CONTEXT_ORDER; static const String PARAM_OUTPUT_FILE; static const String PARAM_OUTPUT_LIST; static const String PARAM_CONTEXT_LIST; static const String PARAM_QUES_ANS; static const String PARAM_PHONETIC_DT; static const String PARAM_PHONETIC_DT_SPLIT_THRESHOLD; static const String PARAM_PHONETIC_DT_MERGE_THRESHOLD; static const String PARAM_PHONETIC_DT_NUM_OCC_THRESHOLD; static const String PARAM_MLLR; static const String OPTION_TEXT; static const String OPTION_BINARY; static const String OPTION_MODE_FILE; static const String OPTION_MODE_TRANSFORM; static const String OPTION_MODE_LIST; static const String OPTION_MODE_DATABASE; static const String OPTION_FORMAT_NIST_SCORE; static const String OPTION_FORMAT_NATIVE; static const String OPTION_FORMAT_JSGF; static const String OPTION_UPDATE_TRANSITIONS; static const String OPTION_UPDATE_OBSERVATIONS; static const String OPTION_UPDATE_ALL; static const String OPTION_FUNCTION_NONE; static const String OPTION_FUNCTION_GRAMMAR_DECODING; static const String OPTION_FUNCTION_NETWORK_DECODING; static const String OPTION_FUNCTION_ACCUMULATE; static const String OPTION_FUNCTION_UPDATE; static const String OPTION_TRANSCRIPTION_LEVEL; //---------------------------------------- // // default values and arguments // //---------------------------------------- // default values // static const bool8 DEF_VERIFY = false; static const bool8 DEF_STREAM = false; static const int32 DEF_NBEST_PATHS = 10; static const int32 DEF_MAX_NBEST_PATHS = 50; static const int32 DEF_NBEST_BEAM = 100; static const int32 DEF_INITIAL_LEVEL = 0; static const int32 DEF_ALIGNMENT_LEVEL = -1; static const int32 DEF_NUM_LEVELS = 3; static const int32 DEF_NUM_MIXTURES = 1; static const int32 DEF_NUM_ITERATIONS = 1; static const int32 DEF_CONTEXT_LEVEL = 0; static const int32 DEF_CONTEXT_ORDER = 3; static const int32 DEF_CAPACITY = 12000; static const float32 DEF_MIN_MPD = 1000; static const float32 DEF_MIN_OCCUPANCY = 1.0e-10; static const int32 DEF_MIN_MODEL_COUNT = 1; static const float32 DEF_VAR_FLOOR = 2e-4; //---------------------------------------- // // error codes // //---------------------------------------- static const int32 ERR = (int32)100000; static const int32 ERR_ADAPT_NO_GAUSSIAN = (int32)100050; //--------------------------------------------------------------------------- // // protected data // //--------------------------------------------------------------------------- protected: // algorithm name // ALGORITHM algorithm_d; // implementation name // IMPLEMENTATION implementation_d; // context mode // CONTEXT_MODE context_mode_d; // cross-word mode // FUNCTION_MODE function_mode_d; // output mode // MODE output_mode_d; // update mode // UPDATE_MODE update_mode_d; // output format // FORMAT output_format_d; // output type // TYPE output_type_d; // update levels // String update_levels_str_d; // vector that contains the indices of re-estimation update levels // VectorByte update_levels_d; // output levels // String output_levels_str_d; // vector that contains the indices of hypothesis output levels // VectorByte output_levels_d; // parameter file // Filename param_file_d; // language model file // Filename lm_file_d; // statistical model pool file // Filename smp_file_d; // configuration file // Filename cnfg_file_d; // fornt-end file // Filename fend_file_d; // updated model file // Filename update_lm_file_d; // updated statistics file // Filename update_smp_file_d; // transcription file // Filename transcription_db_file_d; // audio database file // Filename audio_db_file_d; // symbol graph database file // Filename symbol_graph_db_file_d; // output file // Filename output_file_d; // accumulator file // Filename accum_file_d; // accumulator list // Filename accum_list_d; // acumulator path // Filename accumulator_path_d; // accumulator name // String accumulator_name_d; // output list file // Filename output_list_d; // context generation file // Filename context_list_d; // variance floor file // Filename variance_floor_file_d; // phonetic question-answers file // Filename ques_ans_file_d; // phonetic decision-tree file // Filename phonetic_dt_file_d; // split-threshold for the phonetic-decision-tree // Float phonetic_dt_split_threshold_d; // merge-threshold for the phonetic-decision-tree // Float phonetic_dt_merge_threshold_d; // num_occ-threshold for the phonetic-decision-tree // Float phonetic_dt_num_occ_threshold_d; // variance floor // Float variance_floor_d; // beta pruning threshold // Float beta_threshold_d; // transcription level // String transcription_level_d; // symbol graph level // String symbol_graph_level_d; // initial level // Long initial_level_d; // alignment level // String force_alignment_level_d; // force alignment level // Long alignment_level_d; // context level // Long context_level_d; // context order // Long context_order_d; // n-best hypothesis generation parameters // Long nbest_paths_d; Long max_nbest_paths_d; Long nbest_beam_d; // streaming input flag // bool8 stream_d; // verification mode flag // bool8 verify_d; // front end // Vector vector_fe_d; // utterance trellis // BiGraph* trellis_d; // hierarchical search // HierarchicalSearch search_engine_d; // language model // LanguageModelIHD lm_d; // stack search // StackSearch stack_engine_d; // number of search levels // Long num_levels_d; // number of mixtures // Long num_mixtures_d; // number of iterations of training // Long num_iterations_d; // minimum model probability deviance // Float min_mpd_d; // floor on the occupancy probability // Float min_occupancy_d; // minimum number of times a model must occur before update // Long min_model_count_d; // transcription database // TranscriptionDatabase transcription_db_d; // audio database // AudioDatabase audio_db_d; // Maximum likelihood linear regression object // MaximumLikelihoodLinearRegression mllr_d; // symbol graph database // SymbolGraphDatabase symbol_graph_db_d; // debug level // static Integral::DEBUG debug_level_d; // verbosity // static Integral::DEBUG verbosity_d; // static memory manager // static MemoryManager mgr_d; //--------------------------------------------------------------------------- // // required public methods // //--------------------------------------------------------------------------- public: // method: name // static const String& name() { return CLASS_NAME; } // other static methods // static bool8 diagnose(Integral::DEBUG debug_level); // method: setDebug // bool8 setDebug(Integral::DEBUG debug_level) { debug_level_d = debug_level; HierarchicalSearch::setDebug(debug_level); SymbolGraph::setDebug(debug_level); SymbolGraphNode::setDebug(debug_level); StackSearch::setDebug(debug_level); SearchNode::setDebug(debug_level); Trace::setDebug(debug_level); Instance::setDebug(debug_level); History::setDebug(debug_level); Context::setDebug(debug_level); return true; } // constructor(s)/destructor(s) // ~HiddenMarkovModel(); HiddenMarkovModel(); HiddenMarkovModel(const HiddenMarkovModel& arg); // method: assign // bool8 assign(const HiddenMarkovModel& arg) { return Error::handle(name(), L"assign", Error::ARG, __FILE__, __LINE__); } // i/o methods // int32 sofSize() const; bool8 read(Sof& sof, int32 tag, const String& name = CLASS_NAME); bool8 write(Sof& sof, int32 tag, const String& name = CLASS_NAME) const; bool8 readData(Sof& sof, const String& pname = DEF_PARAM, int32 size = SofParser::FULL_OBJECT, bool8 param = true, bool8 nested = false); bool8 writeData(Sof& sof, const String& param = DEF_PARAM) const; // method: new // static void* operator new(size_t size) { return mgr_d.get(); } // method: new[] // static void* operator new[](size_t size) { return mgr_d.getBlock(size); } // method: delete // static void operator delete(void* ptr) { mgr_d.release(ptr); } // method: delete[] // static void operator delete[](void* ptr) { mgr_d.releaseBlock(ptr); } // method: setGrowSize // static bool8 setGrowSize(int32 grow_size) { return mgr_d.setGrow(grow_size); } //--------------------------------------------------------------------------- // // class-specific public methods // set methods // //--------------------------------------------------------------------------- // method: getStream // bool8 getStream() { return stream_d; } // method: setStream // bool8 setStream(bool8 arg) { return (stream_d = arg); } // method: getAlgorithm // ALGORITHM getAlgorithm() { return algorithm_d; } // method: setAlgorithm // bool8 setAlgorithm(ALGORITHM arg) { return (algorithm_d = arg); } // method: getImplementation // IMPLEMENTATION getImplementation() { return implementation_d; } // method: setImplementation // bool8 setImplementation(IMPLEMENTATION arg) { return (implementation_d = arg); } // method: getContextMode // CONTEXT_MODE getContextMode() { return context_mode_d; } // method: setContextMode // bool8 setContextMode(CONTEXT_MODE arg) { return (context_mode_d = arg); } // method: setFunctionMode // bool8 setFunctionMode(const String& arg); // method: getFunctionMode // FUNCTION_MODE getFunctionMode() { return function_mode_d; } // method: setOutputMode // bool8 setOutputMode(const String& arg); // method: getOutputMode // MODE getOutputMode() { return output_mode_d; } // method: setUpdateMode // bool8 setUpdateMode(const String& arg); // method: getUpdateMode // UPDATE_MODE getUpdateMode() { return update_mode_d; } // method: setOutputFormat // bool8 setOutputFormat(const String& arg); // method: setOutputLevelString // bool8 setOutputLevelString(const String& arg) { return output_levels_str_d.assign(arg); } // method: setUpdateLevelString // bool8 setUpdateLevelString(const String& arg) { return update_levels_str_d.assign(arg); } // method: setAccumulatorPath bool8 setAccumulatorPath(const Filename& arg) { return accumulator_path_d.assign(arg); } // method: setAccumulatorName bool8 setAccumulatorName(const String& arg) { return accumulator_name_d.assign(arg); } // method: getOutputFormat // FORMAT getOutputFormat() { return output_format_d; } // method: setOutputType // bool8 setOutputType(const String& arg); // method: getOutputType // TYPE getOutputType() { return output_type_d; } // method: getParamFile // Filename& getParamFile() { return param_file_d; } // method: setParamFile // bool8 setParamFile(const Filename& arg) { return param_file_d.assign(arg); } // method: getLanguageModelFile // Filename& getLanguageModelFile() { return lm_file_d; } // method: setLanguageModelFile // bool8 setLanguageModelFile(const Filename& arg) { return lm_file_d.assign(arg); } // method: getStatisticalModelPoolFile // Filename& getStatisticalModelPoolFile() { return smp_file_d; } // method: setStatisticalModelPoolFile // bool8 setStatisticalModelPoolFile(const Filename& arg) { return smp_file_d.assign(arg); } // method: getConfigFile // Filename& getConfigFile() { return cnfg_file_d; } // method: setConfigFile // bool8 setConfigFile(const Filename& arg) { return cnfg_file_d.assign(arg); } // method: getFrontEndFile // Filename& getFrontEndFile() { return fend_file_d; } // method: setFrontEndFile // bool8 setFrontEndFile(const Filename& arg) { return fend_file_d.assign(arg); } // method: getLanguageModelUpdateFile // Filename& getLanguageModelUpdateFile() { return update_lm_file_d; } // method: setLanguageModelUpdateFile // bool8 setLanguageModelUpdateFile(const Filename& arg) { return update_lm_file_d.assign(arg); } // method: getStatisticalModelPoolUpdateFile // Filename& getStatisticalModelPoolUpdateFile() { return update_smp_file_d; } // method: setStatisticalModelPoolUpdateFile // bool8 setStatisticalModelPoolUpdateFile(const Filename& arg) { return update_smp_file_d.assign(arg); } // method: getAccumulatorFile // Filename& getAccumulatorFile() { return accum_file_d; } // method: setAccumulatorFile // bool8 setAccumulatorFile(const Filename& arg) { return accum_file_d.assign(arg); } // method: getAccumulatorList // Filename& getAccumulatorList() { return accum_list_d; } // method: setAccumulatorList // bool8 setAccumulatorList(const Filename& arg) { return accum_list_d.assign(arg); } // method: getOutputFile // Filename& getOutputFile() { return output_file_d; } // method: setOutputFile // bool8 setOutputFile(const Filename& arg) { return output_file_d.assign(arg); } // method: getOutputList // Filename& getOutputList() { return output_list_d; } // method: setOutputList // bool8 setOutputList(const Filename& arg) { return output_list_d.assign(arg); } // method: getContextList // Filename& getContextList() { return context_list_d; } // method: setContextList // bool8 setContextList(const Filename& arg) { return context_list_d.assign(arg); } // method: getVarianceFloorFile // Filename& getVarianceFloorFile() { return variance_floor_file_d; } // method: setVarianceFloorFile // bool8 setVarianceFloorFile(const Filename& arg) { return variance_floor_file_d.assign(arg); } // method: getVarianceFloor // float32 getVarianceFloor() { return (float32)variance_floor_d; } // method: setVarianceFloor // bool8 setVarianceFloor(float32 arg) { return variance_floor_d.assign(arg); } // method: getBetaThreshold // float32 getBetaThreshold() { return (float32)beta_threshold_d; } // method: setBetaThreshold // bool8 setBetaThreshold(float32 arg) { return beta_threshold_d.assign(arg); } // method: getInitialLevel // int32 getInitialLevel() { return (int32)initial_level_d; } // method: setInitialLevel // bool8 setInitialLevel(int32 arg) { return initial_level_d.assign(arg); } // method: getContextLevel // int32 getContextLevel() { return (int32)context_level_d; } // method: setContextLevel // bool8 setContextLevel(int32 arg) { return context_level_d.assign(arg); } // method: getContextOrder // int32 getContextOrder() { return (int32)context_order_d; } // method: setContextOrder // bool8 setContextOrder(int32 arg) { return context_order_d.assign(arg); } // method: getNumLevels // int32 getNumLevels() { return (int32)num_levels_d; } // method: setNumLevels // bool8 setNumLevels(int32 arg) { return num_levels_d.assign(arg); } // method: getNumMixtures // int32 getNumMixtures() { return (int32)num_mixtures_d; } // method: setNumMixtures // bool8 setNumMixtures(int32 arg) { return num_mixtures_d.assign(arg); } // method: getNumIterations // int32 getNumIterations() { return (int32)num_iterations_d; } // method: setNumIterations // bool8 setNumIterations(int32 arg) { return num_iterations_d.assign(arg); } // method: getMinProbabilityDeviance // float32 getMinProbabilityDeviance() { return (float32)min_mpd_d; } // method: setMinProbabilityDeviance // bool8 setMinProbabilityDeviance(float32 arg) { return min_mpd_d.assign(arg); } // method: getMinOccupancy // float32 getMinOccupancy() { return (float32)min_occupancy_d; } // method: setMinOccupancy // bool8 setMinOccupancy(float32 arg) { return min_occupancy_d.assign(arg); } // method: getMinModelCount // int32 getMinModelCount() { return (int32)min_model_count_d; } // method: setMinModelCount // bool8 setMinModelCount(int32 arg) { return min_model_count_d.assign(arg); } // method: getSplitThreshold // float32 getSplitThreshold() { return (float32)phonetic_dt_split_threshold_d; } // method: setSplitThreshold // bool8 setSplitThreshold(float32 split_threshold) { phonetic_dt_split_threshold_d = split_threshold; return true; } // method: getMergeThreshold // float32 getMergeThreshold(float32 merge_threshold) { return (float32)phonetic_dt_merge_threshold_d; } // method: setMergeThreshold // bool8 setMergeThreshold(float32 merge_threshold) { phonetic_dt_merge_threshold_d = merge_threshold; return true; } // method: getNumOccThreshold // float32 getNumOccThreshold() { return (float32)phonetic_dt_num_occ_threshold_d; } // method: setNumOccThreshold // bool8 setNumOccThreshold(float32 num_occ_threshold) { phonetic_dt_num_occ_threshold_d = num_occ_threshold; return true; } // method: getDecisionTreeFile // Filename& getDecisionTreeFile() { return phonetic_dt_file_d; } // method: setDecisionTreeFile // bool8 setDecisionTreeFile(const Filename& arg) { return phonetic_dt_file_d.assign(arg); } // method: setQuesAnserFile // bool8 setQuesAnswerFile(const Filename& arg) { return ques_ans_file_d.assign(arg); } // method: getQuesAnserFile // Filename& getQuesAnswerFile() { return ques_ans_file_d; } // method: setVerbosity // bool8 setVerbosity(Integral::DEBUG verbosity) { verbosity_d = verbosity; return true; } // method: setVerify // bool8 setVerify(bool8 verify) { verify_d = verify; return true; } //--------------------------------------------------------------------------- // // class-specific public methods: // computational methods // //--------------------------------------------------------------------------- // run methods // bool8 run(Sdb& sdb); bool8 nonLinearDecoder(Sdb& sdb); bool8 grammarDecoder(Sdb& sdb); bool8 networkDecoder(Sdb& sdb); bool8 linearDecoder(Sdb& sdb); bool8 parameterTying(Sdb& sdb); // parameter check methods // bool8 checkParams(); // load and store methods // bool8 load(); bool8 store(); // method to compute the utterance probability // bool8 computeUtterProb(float64& utter_prob); // method to initialize the models // bool8 initialize(Sdb& sdb); // method to extract all feature vectors from file // bool8 extractFeatures(int32 fe_index, Vector& data); // method sets up a mapping table that assigns a unique index to each vertex // bool8 initializeMappingTable(); // method to accumulate statitics during training // bool8 loadAccumulators(Sdb& sdb); bool8 storeAccumulators(); bool8 accumulate(float64 utter_prob, Vector& data); bool8 accumulateStateTransitions(float64 utter_prob, Vector& data); bool8 accumulateStatisticalModels(float64 utter_prob, Vector& data); // method to update the models using the accumulated statistics // bool8 update(); bool8 updateStateTransitions(SearchLevel& search_level); bool8 updateStatisticalModels(SearchLevel& search_level); // method to load and initialize the transcriptions // bool8 insertNonSpeechSymbols(Vector& boundary_symbols, Vector& internal_symbols, DiGraph& graph, SearchLevel& level); bool8 initTranscription(String& id, int32 arg); // method related to symbol graph rescoring // bool8 initSymbolGraph(Filename& symbol_graph_file); // method related to transcriptions // bool8 agToDigraph(DiGraph& digraph, AnnotationGraph& ag, int32& channel, float32& start_time, float32& stop_time, bool8& is_conversation); bool8 agToSegment(AnnotationGraph& ag, int32& channel, float32& start_time, float32& stop_time); // method to reset the accumulators // bool8 resetAccumulators(); // method for parameter-tying in train mode // bool8 parameterTyingTrain(); // method for parameter-tying in test mode // bool8 parameterTyingTest(); // method to accumulate occupancies during parameter-tying // bool8 loadOccupancies(); // method to create annotation graph from trace // bool8 createAnnotationGraph(AnnotationGraph& anno, DoubleLinkedList& trace_path); // method to create annotation graph from instance // bool8 createAnnotationGraph(AnnotationGraph& anno, DoubleLinkedList& instance_path); // method to prune the annotation graph according to the output levels // bool8 pruneAnnotationGraph(AnnotationGraph& anno); // create statistical model pool // bool8 createStatisticalModels(); //--------------------------------------------------------------------------- // // other public methods // //--------------------------------------------------------------------------- bool8 parseLevels(const String& output_levels_str, VectorByte& output_levels); //--------------------------------------------------------------------------- // // private methods // //--------------------------------------------------------------------------- private: // set methods // GraphArc* getSearchArc(GraphVertex* src, GraphVertex* dst); bool8 insert(VectorByte& src, int32 start_index, int32 num_elem, byte8 mode); bool8 createContexts(Vector& symbols, int32 order, Vector& all_contexts); bool8 appendContexts(Vector& symbols, SearchSymbol symbol, int32 curr_order, int32 order, Vector& all_contexts); // method to write the decoder n-best list to file // bool8 writeNBest(Filename& output_file_name, NBestPath* final_plist, SymbolGraphNode* start_node); }; //end of include file // #endif