LV_SRE_LoadStandardGrammar

Standard Grammars are deprecated in favor of SRGS built-in grammars

Loads a standard, pre-defined grammar to easily recognize and format numbers, monetary figures or digits.

int LV_SRE_LoadStandardGrammar(HPORT hport,int GrammarSet, int StdGrammar);

Return Values

LV_SUCCESS

No errors; the standard grammar is loaded.

LV_STANDARD_GRAMMAR_OUT_OF_RANGE

The standard grammar value is not a recognized grammar type.

LV_GRAMMAR_SET_OUT_OF_RANGE

The standard grammar was loaded into a set that is not in range.

Parameters

GrammarSet

Which grammar set this phrase is being added to.  Possible value range 0 - 63.

StandardGrammar

The standard grammars are:

    1. GRAMMAR_DIGITS
      String of single digits like a phone number or pin code.

    2. GRAMMAR_MONEY
      Monetary value (only implemented for SRGS decodes).

    3. GRAMMAR_NUMERIC
      Numeric value like 12,000, 24.45, or 35).

    4. GRAMMAR_SPELLING
      Alphabet letters for spelling (not implemented).

    5. GRAMMAR_ALPHA_NUMERIC
      (Not implemented).

    6. GRAMMAR_DATE
      Date values (only implemented for SRGS decodes).

    7. GRAMMAR_NONE
      Clears out the standard grammar, without clearing out any phrases that were added.
      ResetGrammar( ) will clear out the entire grammar.

Remarks

The client application can load only one standard grammar, but can add any number of concepts with AddPhrase.   This is not true, however, if you use SRGS grammars.  The correct way to augment as standard SRGS grammar is to load a grammar to a different location, and then activate both.  When a standard grammar is loaded, the decoder will return the number, dollar amount, or digit string as either a single concept, or a single interpretation string, depending on whether SRGS is used or not .

As an example, the client application loads GRAMMAR_NUMBER and also adds the concept and phrase "Widgets".  If the sound data contained the speech "twelve widgets".  The decoder will return two concepts: the first is the string "12" and the second the string "Widgets".  If the speech was "one thousand one hundred and twenty nine Widgets seven point two Widgets", the decoder would return four concepts:  "1129" , "Widgets", "7.2" and  "Widgets" .  

However, If you use SRGS, this is not what happens.  In order to get this sort of functionality in the SRGS setting, you would create a grammar that looks like the following:

#ABNF 1.0;
language en-US;
mode voice;
tag-format <semantics/1.0>;
root $how_many_widgets;

$how_many_widgets = $<builtin:grammar/number> widgets {$=$$;}

In this case you wouldn't bother using LoadStandardGrammar() at all, since the standard number grammar will get loaded when you load this grammar.  The return type would be an interpretation string representing the number that was recognized, like "1129" or "7.2".  The word "widgets" would not be returned in this grammar.

See Also


Complete Help Topic List | Speech Engine Product Information