LVGrammar Summary

The LVGrammar API allows you to manipulate a context-free grammar object that can be used in the engine to recognize speech.

Use <LVSpeechPor.h> or <LV_SRE_Grammar.h>

Return Type

Function

Description

 

 

 

HGRAMMAR

LVGrammar_Create()

Constructs an grammar object.

HGRAMMAR

LVGrammar_CreateFromCopy (HGRAMMAR other)

Constructs an grammar object by copying an existing one.

void

LVGrammar_Copy (HGRAMMAR hgram, HGRAMMAR other)

Copy object pointed by other  to the object pointed by hgram.

void

LVGrammar_Release (HGRAMMAR hgram)

Destroys the grammar object.

int

LVGrammar_Reset (HGRAMMAR hgram)

Reset an grammar object.

void

LVGrammar_RegisterLoggingCallback (HGRAMMAR hgram, GrammarLogCB Log, void* UserData)

Registers a callback so the object can report warnings and errors to the grammar author.

int

LVGrammar_SaveCompiledGrammar (HGRAMMAR hgram, const char* filename)

Save the grammar object to a binary file

int

LVGrammar_LoadCompiledGrammar (HGRAMMAR hgram, const char* filename)

Load the grammar object from a binary file

 

 

 

int

LVGrammar_LoadGrammar (HGRAMMAR hgram, const char* uri)

Loads a grammar from a location specified by the "uri" argument.

int

LVGrammar_LoadGrammarFromBuffer (HGRAMMAR hgram, const char* buffer)

Loads a grammar from a null terminated string containing the contents of the grammar.

int

LVGrammar_AddRule (HGRAMMAR hgram, const char* left_hand_side, const char* right_hand_side)

Inserts a new rule into the grammar.  

int

LVGrammar_RemoveRule (HGRAMMAR hgram, const char* left_hand_side)

Removes a rule from the grammar.

int

LVGrammar_SetRoot (HGRAMMAR hgram, const char* root)

Sets a starting rule for the grammar.

 

 

 

void

LVGrammar_SetMode (HGRAMMAR hgram, const char* mode)

Declare the mode of grammar (the style of decode to be processed).
Legal arguments are "voice" or "dtmf".

const char*

LVGrammar_GetMode (GRAMMAR hgram)

Retrieve the mode of the grammar.

void

LVGrammar_SetLanguage (HGRAMMAR hgram, 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*

LVGrammar_GetLanguage (HGRAMMAR hgram)

Retrieve the language setting of the grammar.

int

LVGrammar_SetTagFormat (HGRAMMAR hgram, 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*

LVGrammar_GetTagFormat (HGRAMMAR hgram)

Retrieve the tag format of the grammar.

int

LVGrammar_GetNumberOfMetaData (HGRAMMAR hgram)

Retrieve number of meta data in the grammar

const char*

LVGrammar_GetMetaDataKey (HGRAMMAR hgram, int index)

Returns the key of the meta data indicated by the index.

const char*

LVGrammar_GetMetaDataValue (HGRAMMAR hgram, int index)

Returns the value of the meta data indicated by the index.

 

 

 

int

LVGrammar_ParseSentence (HGRAMMAR hgram, const char* sentence)

Use the grammar to parse a sentence.

int

LVGrammar_GetNumberOfParses (HGRAMMAR hgram)

Returns the number of parses created by the most recent  LVGrammar_ParseSentence call.

H_PARSE_TREE

LVGrammar_CreateParseTree (HGRAMMAR hgram, int index)

Returns the parse tree handle indicated by the index.

int

LVGrammar_InterpretParses (HGRAMMAR hgram)

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

int

LVGrammar_GetNumberOfInterpretations (HGRAMMAR hgram)

Returns the number of interpretations created by the most recent LVGrammar_InterpretParses call.

H_SI

LVGrammar_CreateInterpretation (HGRAMMAR hgram, int index)

Returns the semantic interpretation handle indicated by the index

 


Complete Help Topic List | Speech Engine Product Information