Rss Categories

LVGrammar C++ API Summary

Reference Number: AA-00859 Views: 3047 0 Rating/ Voters

An LVGrammar object represents a context-free grammar that can be used in the Speech Engine to recognize speech. An LVGrammar object can also be used to test the functionality of a grammar by processing transcripts.

Use <LV_SRE_Grammar.h>

Return Type Function Description
  LVGrammar ( ) Constructs an LVGrammar object.
  LVGrammar (GrammarLogCB log, void* userdata) Constructs an LVGrammar object, with an initial logging function.
  LVGrammar (const LVGrammar& other) Copy constructor.
  ~LVGrammar ( ) Destroys the LVGrammar object.
LVGrammar& operator = (const LVGrammar& other) Assignment operator
void RegisterLoggingCallback(GrammarLogCB log, void* userdata) Registers a callback so the object can report warnings and errors to the grammar author.
int Reset ( ) Reset a grammar object.
HGRAMMAR GetHGrammar ( ) Returns the underlying object handle.
int LoadGrammar (const char* location) Loads a grammar from a location specified by the "uri" argument.
int LoadGrammarFromBuffer (const char* contents) Loads a grammar from a null terminated string containing the contents of the grammar.
int AddRule (const char* rulename, const char* definition) Inserts a new rule into the grammar.
int RemoveRule (const char* rulename) Removes a rule from the grammar.
int SetRoot (const char* rulename) Sets a starting rule for the grammar.
void SetMode (const char* mode) Declare the mode of grammar (the style of decode to be processed). Legal arguments are "voice" or "dtmf".
const char* GetMode ( ) Return the interaction mode of the grammar.
void SetLanguage (const char* language) Specify the language of this grammar as a language/country code pair. Legal arguments include "en-US" and "es-MX".
const char* GetLanguage ( ) Return the language setting of the grammar.
void SetTagFormat (const char* tag_format) Identify the tag format of the grammar.  To use the LumenVox semantic interpretation, the tag format must be "lumenvox/1.0" or "semantics/1.0".
const char* GetTagFormat ( ) Return the tag format setting of the grammar.
int GetNumberOfMetaData ( ) Return the number of meta data in the grammar.
const char* GetMetaDataKey (int index) Return the key of the meta data with a specified index
const char* GetMetaDataValue (int index) Return the value of the meta data with a specified index
int ParseSentence (const char* sentence) Use the grammar to parse a sentence.
int NumberOfParses ( ) Returns the number of parses created by the most recent ParseSentence call.
LVParseTree GetParseTree (int index) Returns the parse tree object created with a specified index
int InterpretParses ( ) Generate interpretations form parses trees created by the most recent ParseSentence call.
int GetNumberOfInterpretations ( ) Returns the number of interpretations created the most recent InterpretParses call.
LVInterpretation GetInterpretation (int index) Returns the semantic interpretation with the specified index