Browse
 
Tools
Rss Categories

Built-in Grammars

Reference Number: AA-01079 Views: 4438 0 Rating/ Voters

LumenVox provides the built-in grammars expected by VoiceXML users:

  

URI

  
  

Sample Input

  
  

Semantic Interpretation Result

  
  

builtin:grammar/boolean

  
  

"yes",   "no thank you", etc.

  
  

"true" or   "false"

  
  

builtin:grammar/date

  
  

"january   thirteenth" or "december first two thousand"

  
  

"????0113"   or "20001201"

  
  

builtin:grammar/digits

  
  

"one two three   four"

  
  

"1234"

  
  

builtin:grammar/currency

  
  

"eighteen dollars   and four cents"

  
  

"USD18.04"

  
  

builtin:grammar/number

  
  

"four hundred   point five"

  
  

"400.5"

  
  

builtin:grammar/phone

  
  

"area code eight   five eight seven oh seven oh seven oh seven"

  
  

"8587070707"

  
  

builtin:grammar/time

  
  

"six o   clock" or "five thirty p m"

  
  

"0600?" or   "0530p"

  


Switching the Language for Built-in Grammars

By default, built-in grammars use US English as their language. So simply specifying builtin:grammar/digits will cause the ASR to use the US English digits grammar. However, if you are working with other languages, it can be useful to switch the language used with built-in grammars.

Changing language with SetPropertyEx

Users writing applications using LumenVox's C or C++ API should use the appropriate function as discussed in the Speech Port Properties articles to set the PROP_EX_BUILTIN_GRAMMAR_LANGUAGE property to the appropriate language identifier. For example, to use Mexican Spanish, the following C code would achieve the desired result:

  • char * builtin_language = "es-MX"; 
    LV_SRE_SetPropertyEx(NULL, PROP_EX_BUILTIN_GRAMMAR_LANGUAGE, PROP_EX_VALUE_TYPE_STRING, (void*)builtin_language, PROP_EX_TARGET_CLIENT, 0);


Using Built-in Grammars with MRCP

When using MRCP connectivity with LumenVox via the Media Server interface, you also need to specify the language you would like to use for builtin grammars, since the name itself does not indicate any language.

To do this, you need to ensure that your MRCP request (RECOGNIZE, SET-PARAMS, DEFINE-GRAMMAR, INTERPRET-TEXT, etc.) has the correct 'Speech-Language' header assigned to the request packet, as shown below:


RTSP (MRCPv1) "DEFINE-GRAMMAR" Example using Brazilian Portuguese:

   C->S:  DEFINE-GRAMMAR 543258 MRCP/1.0
          Content-Type: text/uri-list
          Speech-Language: pt-BR
          Content-Length: 22

          builtin:grammar/digits

   S->C:  MRCP/1.0 543259 200 COMPLETE


SIP (MRCPv2) "DEFINE-GRAMMAR" Example using Brazilian Portuguese:

   C->S: MRCP/2.0 ... DEFINE-GRAMMAR 543258
         Channel-Identifier:32AECB23433802@speechrecog
         Content-Type: text/uri-list
         Speech-Language: pt-BR
         Content-Length: 22

         builtin:grammar/digits

   S->C: MRCP/2.0 ... 543259 200 COMPLETE
         Channel-Identifier:32AECB23433802@speechrecog



Modifying Built-in Grammars or Adding Languages

All of the built-in grammars are stored on disk in one of two locations:

  • Windows: Program Files\LumenVox\Engine\Lang\BuiltinGrammars\voice\
  • Linux/etc/lumenvox/Lang/BuiltinGrammars/voice/

Inside the voice directory are sub-directories with language names. Inside of the individual language directory is a set of grammars whose names correspond to the built-in grammar types defined above (e.g. digits, phone, etc.).

LumenVox only includes a limited number of builtin grammars, with some languages (notably en-US and es-MX) having more grammars than other languages, however users are free to add other directories with custom grammars to add support for built-in grammars in additional languages or additional builtin grammars for their chosen languages.

For example, to add support for a Canadian French date built-in grammar, simply go to (or create) a directory called fr-CA in your BuiltInGrammars/voice folder and create a new grammar named date, containing the various grammar rules you wish to use. Note that you will have to create these grammars yourself, but you can use our built-in grammars as a guide.

Version 14.1
Prior to LumenVox version 14.1, only provided builtin grammars for en-US and es-MX ASR languages. With the introduction of version 14.1, LumenVox also provides simple builtin:grammar/digits for all supported ASR languages.

Version 14.2
With the release of LumenVox 14.2, support for builtin:grammar/boolean was added for the Brazilian Portuguese (pt-BR) ASR language.

This same logic also allows users to modify the behavior of the existing built-in grammars by modifying the contents of the existing en-US or es-MX directories, but we recommend you backup your files  first before making changes to them so that the originals can be restored in the event that you later wish to revert your changes.


Behavior of Builtin Grammars

There is no clearly defined behavior specified for any of the builtin grammars, which is why we do not support all possible combinations in all languages.

We have, however, exposed the above mechanism that allows developers to create their own builtin grammars, or modify the simply templates provided by LumenVox as needed.