Browse
 
Tools
Rss Categories

Built-in Grammars

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

LumenVox provides the following 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' 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 or adding to Built-in Grammars

All of the built-in grammars are stored on disk in one of these two locations, based on your Operating System:

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

Inside the voice directory are sub-directories with language identifiers (such as en-US). Inside each individual language directory is a set of grammars whose names correspond to the built-in grammars described in this article (e.g. digits, phone, etc.).

This same logic also allows users to modify the behavior of the existing built-in grammars by modifying the contents of the existing directories, however we recommend you back up your files before making changes to them so that the originals can be restored in the event that you later wish to revert your changes.

In addition to the existing builtin grammars, you are also able to add your own grammars into these folders and reference them using the builtin syntax. For example, if you wanted to add a new British English welcomegrammar, you could simply create a grammar file with the name welcome inside the BuiltinGrammars/voice/en-GB/ folder, which could then be referenced as builtin:grammar/welcome within your application code whenever you have the British English (en-GB) language active. Note that you will have to create these grammars yourself, but you can use our existing built-in grammars as a guide.


Version 15.0 Builtin Grammars

Starting with LumenVox version 15.0, a broader selection of builtin grammars was added across all supported ASR languages. These are described in the following table:

boolean currency date digits number phone time
American English
en-US
X X X X X X X
British English
en-GB
X X X X X X X
Australian English
en-AU
X X X X X X X
Indian English
en-IN
X X X X X X X
Colombian Spanish
es-CO
X X X X X X X
Mexican Spanish
es-MX
X X X X X X X
Canadian French
fr-CA
X X X X X X X
Brazilian Portuguese
pt-BR
X X X X X X X

Builtin Grammars Prior to Version 15.0

Earlier versions of LumenVox only included a limited number of builtin grammars, with some languages (notably en-US and es-MX) having more grammars than other languages, however users were, and still are, free to add other custom builtin grammars for their chosen languages, as described above.

Some version specific changes to builtin grammars are shown below:

Version 14.1
Prior to version 14.1, LumenVox only provided builtin grammars for en-US and es-MX ASR languages. With the introduction of version 14.1, LumenVox also provided 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.


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, which is described above.

Since there is no universally accepted definition for these grammars, users often have differing requirements, so the goal of providing these builtin grammars, is to allow developers to use these as templates where needed for their own specific needs. If users have any suggestions for additions or changes to our builtin grammar support, please contact your Client Services representative.