Grammar Testing API

This API is brief, because the functionality is parallel to functionality in LVSpeechPortABNF.h and SpeechParseTree.h

#include <LVSpeechGrammar.h>

#include <TextParseTree.h>

Return Codes:

LV_SPEECH_GRAMMAR_NO_ERROR

LV_SPEECH_GRAMMAR_WARNING

LV_SPEECH_GRAMMAR_ERROR

 

class LVSpeechGrammar

Represents an SRGS-ABNF style grammar description

 

int AddRule (const char* rule_name, const char* rule_expansion)

see LVSpeechPortABNF_AddRule

int RemoveRule (const char* rule_name)

see LVSpeechPortABNF_RemoveRule

int SetRoot (const char* rule_name)

see LVSpeechPortABNF_SetRoot

int ValidateGrammar ()

see LVSpeechPortABNF_ValidateGrammar

int LoadGrammarFromFile (const char* filename_or_url)

see LVSpeechPortABNF_LoadGrammarFromFile

void RegisterLoggingCallback(GrammarLogCallback CB, void* data)

The callback function needs to be of the form:

void CB(const char* msg, int error_level, void* data)

 

 

class LVTextParser

Represents a compiled parsing tool, for parsing text sentences using a given grammar.

 

LVTextParser (const LVSpeechGrammar& Grammar)

Initialized by an LVSpeechGrammar object

int ParseText (const char* sentence)

returns the number of successful parses

const TextParseTree& GetParseTree(int index)

 

int GetNumberOfParses()

same return value as the previous call to ParseText

 

 

class TextParseTree

Represents a parse tree (sentence diagram) for a given sentence and grammar

see class SpeechParseTree

 


Complete Help Topic List | Speech Engine Product Information