class LVGrammar

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 <LVSpeechPor.h> or <LV_SRE_Grammar.h>

Return Type

Function

Description

 

 

 

 

LVGrammar (void)

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 (void)

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 (void)

Reset a grammar object.

int

SaveCompiledGrammar (const char* filename)

Save the grammar object to a binary file.

int

LoadCompiledGrammar (const char* filename)

Load the grammar object from a binary file

HGRAMMAR

GetHGrammar (void)

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 (void)

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 (void)

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 (void)

Return the tag format setting of the grammar.

int

GetNumberOfMetaData (void)

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 (void)

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 (void)

Generate interpretations form parses trees created by the most recent ParseSentence call.

int

GetNumberOfInterpretations (void)

Returns the number of interpretations created the most recent InterpretParses call.

LVInterpretation

GetInterpretation (int index)

Returns the semantic interpretation with the specified index

 

 

 

 

 

 

 


Complete Help Topic List | Speech Engine Product Information