name: LanguageModelXML

synopsis:

 
g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_mmedia.a

#include <LanguageModelXML.h>

boolean read(Sof& sof, long tag, const String& cname = CLASS_NAME);
RuleModel getRuleModel();
quick start:

Sof sof;
sof.open("lm_xml_obj.sof", File::READ_ONLY);

LanguageModelXML lmxml;
lmxml.read(sof, 0);

LanguageModelIHD lmihd;
lmihd.setRuleModel(lmxml.getRuleModel());

HierarchicalDigraph hg;
hg.assign(lmihd.getHDigraph());
description:

The broad goal of the LanguageModelXML class is to parse XML format grammars as specified by the
W3C Speech Recognition Grammar Specification Version 1.0 and convert them into IHD with the help of other LanguageModel classes and to perform the reverse conversion. LanguageModelXML helps perform the XML->IHD conversion by converting the XML to ABNF then calling LanguageModelABNF functions to convert from ABNF->BNF. These BNF productions may then be used as the argument of a setRuleModel() for a LanguageModelIHD, and the equivalent IHD may be obtained with a call to LanguageModelIHD's getHDigraph(). The reverse conversion (IHD->XML) starts when the BNF production rules for an IHD are obtained via a LanguageModelIHD object's getRuleModel(). These BNF productions are then fed to a LanguageModelXML object's setRuleModel(), initiating the conversion from BNF->XML. The resulting XML may then be retrieved by outputting the LanguageModelXML object to a file or through the getXMLModel() method. The XMLParser class is used to parse all XML format content.

When an XML grammar is converted to IHD format, occurrences of the special rule NULL (<ruleref special='NULL'/>) will translate into "dummy" nodes (nodes which require no input). The default name of these dummy symbols will be "isip_rule_null", but any other name may be specified by defining the isip_rule_null attribute in the grammar start tag. For example:

<grammar isip_rule_null='dummy_symbol'>

This will set the name of the dummy nodes to "dummy_symbol".

dependencies:

public constants:

error codes:

protected data:

required public methods:

class-specific public methods:

class-specific protected methods:

examples:

notes: