quick start:g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_mmedia.a #include <LanguageModelIHD.h> boolean read(Sof& sof, long tag, const String& cname = CLASS_NAME); HierarchicalDigraph& getHDigraph();
description:Sof sof; sof.open("lm_ihd_obj.sof", File::READ_ONLY); LanguageModelIHD lmihd; lmihd.read(sof, 0); HierarchicalDigraph hg; hg.assign(lmihd.getHDigraph());
static const String LanguageModelIHD::CLASS_NAME = L"LanguageModelIHD";
static const String LanguageModelIHD::DEF_PARAM = L"";
static const String LanguageModelIHD::PARAM_IHD = L"h_digraph";
static const long ERR = 100102;
static MemoryManager mgr_d;
HierarchicalDigraph hg_d;
static const String& name();
static boolean diagnose(Integral::DEBUG debug_level);
boolean debug(const unichar* msg) const;
~LanguageModelIHD();
LanguageModelIHD();
boolean read(Sof& sof, long tag, const String& cname = CLASS_NAME);
boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);
boolean write(Sof& sof, long tag, const String& cname = CLASS_NAME) const;
boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const;
long sofSize() const;
boolean assign(const LanguageModelIHD& arg);
boolean assign(const LanguageModelBase& arg);
boolean eq(const LanguageModelIHD& arg) const;
boolean eq(const LanguageModelBase& arg) const;
boolean clear(Integral::CMODE ctype);
boolean setRuleModel(const RuleModel& hg);other methods:
const String& className() const;
RuleModel getRuleModel();
boolean setRuleModel(const RuleModel& rm);
HierarchicalDigraph& getIHD();
boolean setIHD(const HierarchicalDigraph& hg);private methods:
Vector<Pair<String, SearchSymbol>> findTerminals(Vector<ProductionRule> rules, String rule_name);examples:
// declare an sof object to parse the file // Sof sof; // open the file for reading // sof.open("lm_ihd_obj.sof", File::READ_ONLY); // declare a LMIHD object to read the grammars // LanguageModelIHD lmihd; // read the grammars // lmihd.read(sof, 0); // declare an HierarchicalDigraph object to store the grammars in DiGraph form // HierarchicalDigraph hg; // retrieve the grammars from the LMIHD object, and store them in the HD object // hg.assign(lmihd.getHDigraph());