// file: $isip/class/pr/LanguageModelIHD/LanguageModelIHD.h // // make sure definitions are only made once // #ifndef ISIP_LANGUAGE_MODEL_IHD #define ISIP_LANGUAGE_MODEL_IHD #ifndef ISIP_LANGUAGE_MODEL_BASE #include #endif // forward class definitions // // LanguageModelIHD: Used for language models in IHD format. IHD is the // standard ISIP compiled language model format. // class LanguageModelIHD : public LanguageModelBase { //--------------------------------------------------------------------------- // // public constants // //--------------------------------------------------------------------------- public: // define the class name // static const String CLASS_NAME; //-------------------------------------------------------------- // // other important constants // //-------------------------------------------------------------- //---------------------------------------- // // i/o related constants // //---------------------------------------- static const String DEF_PARAM; static const String PARAM_IHD; //---------------------------------------- // // default values and arguments // //---------------------------------------- //---------------------------------------- // // error codes // //---------------------------------------- static const int32 ERR = 100102; //--------------------------------------------------------------------------- // // protected data // //--------------------------------------------------------------------------- protected: // debug level // // debug_level_d inherited from LanguageModelBase // hierarchical digraph // HierarchicalDigraph hg_d; // memory manager // static MemoryManager mgr_d; //--------------------------------------------------------------------------- // // required public methods // //--------------------------------------------------------------------------- public: // method: name // static const String& name() { return CLASS_NAME; } // method: diagnose // static bool8 diagnose(Integral::DEBUG debug_level); // debug methods // bool8 debug(const unichar* msg) const { return hg_d.debug(L"hg_d"); } // method: setDebug // // inherited from LanguageModelBase // method: destructor // ~LanguageModelIHD() { } // method: default constructor // LanguageModelIHD() { } // method: copy constructor // LanguageModelIHD(const LanguageModelIHD& arg) { assign(arg); } // assign methods // bool8 assign(const LanguageModelIHD& arg) { return hg_d.assign(arg.hg_d); } // i/o methods // // method: sofSize // int32 sofSize() const { return hg_d.sofSize(); } // method: read // bool8 read(Sof& sof, int32 tag, const String& cname = CLASS_NAME); // method: write // bool8 write(Sof& sof, int32 tag, const String& cname = CLASS_NAME) const; // method: readData // bool8 readData(Sof& sof, const String& pname = DEF_PARAM, int32 size = SofParser::FULL_OBJECT, bool8 param = true, bool8 nested = false); // method: writeData // bool8 writeData(Sof& sof, const String& pname = DEF_PARAM) const; // other memory managements methods // bool8 clear(Integral::CMODE cmode = Integral::DEF_CMODE) { return hg_d.clear(); } // equality methods // bool8 eq(const LanguageModelIHD& arg) const { return hg_d.eq(arg.hg_d); } //--------------------------------------------------------------------------- // // class-specific public methods required by interface contract // defined in LanguageModelBase.h // //--------------------------------------------------------------------------- // LanguageModelBase required methods // bool8 assign(const LanguageModelBase& arg); bool8 eq(const LanguageModelBase& arg) const; //-------------------------------------------------------- // // load and store methods // //-------------------------------------------------------- //-------------------------------------------------------- // // other methods // //-------------------------------------------------------- // method: className // const String& className() const { return CLASS_NAME; } // method: getRuleModel // RuleModel getRuleModel(); // method: setRuleModel // bool8 setRuleModel(const RuleModel& rm); // method: getHDigraph // HierarchicalDigraph& getIHD() { return hg_d; } // method: setHDigraph // bool8 setIHD(const HierarchicalDigraph& hg) { return hg_d.assign(hg); } //--------------------------------------------------------------------------- // // private methods // //--------------------------------------------------------------------------- private: // method: isEpsilon // bool8 isEpsilon(Vector rules, String rule_name); // method: findTerminals // Vector > findTerminals(Vector rules, String rule_name); }; // end of include file // #endif