// file: $isip/class/asr/SpeechRecognizer/SpeechRecognizer.h // version: $Id: SpeechRecognizer.h 9834 2004-10-11 18:14:53Z raghavan $ // // make sure definitions are only made once // #ifndef ISIP_SPEECH_RECOGNIZER #define ISIP_SPEECH_RECOGNIZER #ifndef ISIP_HIDDEN_MARKOV_MODEL #include #endif // SpeechRecognizer: a class to set up parameters of the SpeechRecognizer // system and run it // class SpeechRecognizer { //-------------------------------------------------------------------------- // // public constants // //-------------------------------------------------------------------------- public: // define the class name // static const String CLASS_NAME; //---------------------------------------- // // error codes // //---------------------------------------- static const int32 ERR = (int32)110000; // define algorithm types // enum ALGORITHM { HMM = 0, BN, NN, DEF_ALGORITHM = HMM }; //--------------------------------------------------------------------------- // // protected data // //--------------------------------------------------------------------------- protected: // algorithm type // ALGORITHM algorithm_d; // verification mode flag // bool8 verify_d; // parameter file // Filename param_file_name_d; // hidden markov model object // HiddenMarkovModel hmm_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; return true; } // constructor(s)/destructor(s) // SpeechRecognizer(); SpeechRecognizer(const SpeechRecognizer& arg); ~SpeechRecognizer(); // assign method // bool8 assign(const SpeechRecognizer& arg); //--------------------------------------------------------------------------- // // class-specific public methods // //--------------------------------------------------------------------------- // method: setStream // bool8 setStream(bool8 stream){ return hmm_d.setStream(stream); } // method: setAlgorithm // bool8 setAlgorithm(ALGORITHM algorithm) { algorithm_d = algorithm; return true; } // method: setParam // bool8 setParam(String param_file_name); // method: setVerbosity // bool8 setVerbosity(Integral::DEBUG verbosity) { verbosity_d = verbosity; return true; } // method: setVerify // bool8 setVerify(bool8 verify) { verify_d = verify; return true; } // method: setLanguageModelFile // bool8 setLanguageModelFile(String& lm_file) { if (lm_file.length() != 0) { return hmm_d.setLanguageModelFile(lm_file); } return false; } // method: setLanguageModelUpdateFile // bool8 setLanguageModelUpdateFile(String& lm_file) { if (lm_file.length() != 0) { return hmm_d.setLanguageModelUpdateFile(lm_file); } return false; } // method: setStatisticalModelPoolFile // bool8 setStatisticalModelPoolFile(String& ac_file) { if (ac_file.length() != 0) { return hmm_d.setStatisticalModelPoolFile(ac_file); } return false; } // method: setStatisticalModelPoolUpdateFile // bool8 setStatisticalModelPoolUpdateFile(String& ac_file) { if (ac_file.length() != 0) { return hmm_d.setStatisticalModelPoolUpdateFile(ac_file); } return false; } // method: setFunctionMode // bool8 setFunctionMode(String& function_mode) { if (function_mode.length() != 0) { return hmm_d.setFunctionMode(function_mode); } return false; } // method: setOutputMode // bool8 setOutputMode(String& output_mode) { if (output_mode.length() != 0) { return hmm_d.setOutputMode(output_mode); } return false; } // method: setOutputFormat // bool8 setOutputFormat(String& output_format) { if (output_format.length() != 0) { return hmm_d.setOutputFormat(output_format); } return false; } // method: setAccumulatorFile // bool8 setAccumulatorFile(Filename& accum_file) { if (accum_file.length() != 0) { return hmm_d.setAccumulatorFile(accum_file); } return false; } // method: setAccumulatorList // bool8 setAccumulatorList(Filename& accum_list) { if (accum_list.length() != 0) { return hmm_d.setAccumulatorList(accum_list); } return false; } // method setOutputFile // bool8 setOutputFile(Filename& output_file) { if (output_file.length() != 0) { return hmm_d.setOutputFile(output_file); } return false; } // method: setSplitThreshold // bool8 setSplitThreshold(const String& split_threshold) { if (split_threshold.length() != 0 ){ Float value; value.assign(split_threshold); hmm_d.setSplitThreshold(value); return true; } return false; } // method: setMergeThreshold // bool8 setMergeThreshold(const String& merge_threshold) { if (merge_threshold.length() != 0 ){ Float value; value.assign(merge_threshold); hmm_d.setMergeThreshold(value); return true; } return false; } // method: setNumOccThreshold // bool8 setNumOccThreshold(const String& num_occ_threshold) { if ( num_occ_threshold.length() != 0 ){ Float value; value.assign(num_occ_threshold); hmm_d.setNumOccThreshold(value); return true; } return false; } // method: setDecisionTreeFile // bool8 setDecisionTreeFile(const Filename& arg) { if ( arg.length() != 0 ){ return hmm_d.setDecisionTreeFile(arg); } return false; } // method: setQuesAnserFile // bool8 setQuesAnswerFile(const Filename& arg) { if ( arg.length() != 0){ return hmm_d.setQuesAnswerFile(arg); } return false; } // method: setOutputList // bool8 setOutputList(Filename& output_list) { if (output_list.length() != 0) { return hmm_d.setOutputList(output_list); } return false; } // method: setOutputLevelString // bool8 setOutputLevelString(String& output_level) { if (output_level.length() != 0) { return hmm_d.setOutputLevelString(output_level); } return false; } // method: setUpdateLevelString // bool8 setUpdateLevelString(String& update_level) { if (update_level.length() != 0) { return hmm_d.setUpdateLevelString(update_level); } return false; } // method: setAccumulatorPath // bool8 setAccumulatorPath(Filename& accumulator_path) { if (accumulator_path.length() != 0) { return hmm_d.setAccumulatorPath(accumulator_path); } return false; } // method: setAccumulatorName // bool8 setAccumulatorName(String& accumulator_name) { if (accumulator_name.length() != 0) { return hmm_d.setAccumulatorName(accumulator_name); } return false; } //--------------------------------------------------------------------------- // // class-specific public methods: // get methods // //--------------------------------------------------------------------------- // method: getAlgorithm // ALGORITHM getAlgorithm() const { return algorithm_d; } //--------------------------------------------------------------------------- // // class-specific public methods: // computational methods // //--------------------------------------------------------------------------- // method: run // bool8 run(Sdb& sdb); //--------------------------------------------------------------------------- // // private methods // //--------------------------------------------------------------------------- private: }; //end of include file // #endif