// file: $isip/class/pr/LanguageModel/LanguageModelBase.h // // make sure definitions are only made once // #ifndef ISIP_LANGUAGE_MODEL_BASE #define ISIP_LANGUAGE_MODEL_BASE // isip include files // #ifndef ISIP_SOF #include #endif #ifndef ISIP_VECTOR #include #endif #ifndef ISIP_HIERARCHICAL_DIGRAPH #include #endif #ifndef ISIP_STRING #include #endif #ifndef ISIP_FILENAME #include #endif #ifndef ISIP_FILE #include #endif #ifndef ISIP_PRODUCTIONRULE #include #endif #ifndef ISIP_DEBUGLEVEL #include #endif typedef Vector< ProductionRule > ProductionRuleSet; typedef Pair< Vector< Vector >, HierarchicalDigraph> RuleModel; // LanguageModelBase: defines the minimal interface contract for all // language model classes // class LanguageModelBase { //--------------------------------------------------------------------------- // // public constants // //--------------------------------------------------------------------------- public: // define the class name // static const String CLASS_NAME; //-------------------------------------------------------------- // // other important constants // //-------------------------------------------------------------- // default level index // static const int32 DEF_LEVEL_INDEX = -1; // default statistical model pool file // static const Filename DEF_SMP; //---------------------------------------- // // error codes // //---------------------------------------- static const int32 ERR = 100100; //--------------------------------------------------------------------------- // // protected data // //--------------------------------------------------------------------------- protected: // debugging parameters // DebugLevel debug_level_d; // RuleModel object // RuleModel rm_d; //--------------------------------------------------------------------------- // // required public methods // //--------------------------------------------------------------------------- public: // method: name // static const String& name() { return CLASS_NAME; } // debug methods // virtual bool8 debug(const unichar* msg) const = 0; // method: setDebug // bool8 setDebug(Integral::DEBUG level) { debug_level_d = level; rm_d.setDebug(level); return true; } // method: getDebug // DebugLevel getDebug() { return debug_level_d; } // method: destructor // virtual ~LanguageModelBase() { } // method: default constructor // LanguageModelBase() { } // assign methods // virtual bool8 assign(const LanguageModelBase& arg) = 0; // i/o methods // virtual int32 sofSize() const = 0; virtual bool8 read(Sof& sof, int32 tag, const String& cname) = 0; virtual bool8 write(Sof& sof, int32 tag, const String& cname) const = 0; virtual bool8 readData(Sof& sof, const String& pname, int32 size, bool8 param, bool8 nested) = 0; virtual bool8 writeData(Sof& sof, const String& pname) const = 0; // equality methods // virtual bool8 eq(const LanguageModelBase& arg) const = 0; // memory managements methods // virtual bool8 clear(Integral::CMODE cmode = Integral::DEF_CMODE) = 0; //--------------------------------------------------------------------------- // // class-specific public methods: these methods define the // interface contract. // //--------------------------------------------------------------------------- // method: className // virtual const String& className() const = 0; // method: retrieve equivalent BNF production rules // virtual RuleModel getRuleModel() = 0; // method: pass in equivalent BNF production rules // virtual bool8 setRuleModel(const RuleModel& hg) = 0; //-------------------------------------------------------- // // load and store methods // //-------------------------------------------------------- //-------------------------------------------------------- // // other methods // //-------------------------------------------------------- //--------------------------------------------------------------------------- // // protected methods // //--------------------------------------------------------------------------- protected: }; // end of include file // #endif