Browse
 
Tools
Rss Categories

LVGrammar::ParseSentence

Reference Number: AA-00879 Views: 6329 0 Rating/ Voters

Use a loaded grammar object to parse a sentence.

Function

  • int ParseSentence(const char* sentence)

Parameters

sentence

The sentence to parse.

Return Values

0

The sentence is not covered by the grammar.

non-0

The number of distinct parses.

Example

Assume a grammar was defined as:

#ABNF 1.0 UTF-8;
language en-US;
mode voice;

root $yes_no;

$yes_no = $yes | $no;
$yes = yes [please];
$no = no [thank you];

You can use this grammar to validate sentences as follows:

int count = LVGrammar_ParseSentence(grammar, "no thank you"); // Returns 1
int count = LVGrammar_ParseSentence(grammar, "no thanks"); // Returns 0

Remarks

With this function, you can identify how well a grammar covers your targeted transcript set.

See Also