Builtin Grammars

The platform provides the following built-in grammars for use with voice applications:

URISample InputSemantic 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"

Selecting the Language for Built-in Grammars

Unless otherwise specified, built-in grammars will use the US English language selector. Specifying builtin:grammar/digits will use the US English digits grammar. If you are working with other languages, you will need to specify the language for built-in grammars explicitly.

Specifying the Language using a Query Parameter

A language code can be appended to any built-in grammar URI as a language query parameter. The language code may be a base language (e.g. es) or include an optional dialect tag (e.g. pt-BR for Brazilian Portuguese). For example:

builtin:grammar/date?language=pt-BR

This selects the Brazilian Portuguese variant of the date grammar regardless of any session-level language setting.

Referencing a Built-in Grammar from Within Another Grammar

When referencing a built-in grammar from inside another grammar, use a rule reference with the same URI syntax. In an ABNF grammar:

$<builtin:grammar/digits?language=es-ES>;

In a GrXML grammar:

<ruleref uri="builtin:grammar/digits?language=es-ES" />

Using Built-in Grammars with MRCP

When using MRCP connectivity via the Media Server interface, you must specify the language for built-in grammars in your MRCP request, since the URI itself does not indicate any language. Ensure your MRCP request (RECOGNIZE, SET-PARAMS, DEFINE-GRAMMAR, INTERPRET-TEXT, etc.) includes the correct Speech-Language header.

RTSP (MRCPv1) DEFINE-GRAMMAR Example — 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 — 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

Built-in Grammars by Language

The following table shows built-in grammar support across all supported ASR languages:


booleancurrencydatedigitsnumberphonetime
Swiss German
de-CH
 
 
 
 
 
 
 
German
de-DE
 
 
 
 
 
 
 
Australian English
en-AU
 
 
 
 
 
 
 
British English
en-GB
 
 
 
 
 
 
 
Indian English
en-IN
 
 
 
 
 
 
 
American English
en-US
 
 
 
 
 
 
 
Colombian Spanish
es-CO
 
 
 
 
 
 
 
Castilian Spanish
es-ES
 
 
 
 
 
 
 
Mexican Spanish
es-MX
 
 
 
 
 
 
 
Canadian French
fr-CA
 
 
 
 
 
 
 
European French
fr-FR
 
 
 
 
 
 
 
Italian
it-IT
 
 
 
 
 
 
 
Japanese
ja-JA
 
 
 
 
 
 
 
Dutch
nl-NL
 
 
 
 
 
 
 
Brazilian Portuguese
pt-BR
 
 
 
 
 
 
 
European Portuguese
pt-PT
 
 
 
 
 
 
 
Russian
ru-RU
 
 
 
 
 
 
 

Other Special Grammars

In addition to the built-in grammars above, the following special built-in grammars are available for Answering Machine Detection (AMD) and Call Progress Analysis (CPA):

URIDescription
builtin:special/amdAnswering Machine Detection (AMD)
builtin:special/cpaCall Progress Analysis (CPA)

Behavior of Built-in Grammars

There is no universally defined behavior for built-in grammars, which is why not all grammar types are supported in all languages. The built-in grammars provided are intended as working templates that developers can customize for their specific needs. You can use the existing grammars as a starting point and modify them as required. For suggestions or requests regarding built-in grammar support, contact your Client Services representative.


Was this article helpful?