Available grammars

Currently supported languages are French, English, Spanish and German. Some grammars might not yet been available for some language. If so, it will be specified within the grammar's own section.

Examples below only show the response body.

Multi-grammars

Support of multiple grammars is available using command RECOGNIZE, and passing grammars in the body.

Note that grammars can not be weighted. The first matching grammar will be returned. In case several grammar match at the same time, the first one listed will be returned.

Keep in mind that using always matching grammars (such as transcribe or text2num) does not make sense, as they will match each and everytime. Multi-grammar works better with mutually exclusive grammars that don't overlap too much one another.

Default

Raw ASR, without any interpretation and using only words in letters (no digits, to get them check out the "text2num" grammar).

Grammar name:

  • builtin:grammar/none
  • builtin:speech/transcribe: alias to builtin:grammar/none,
  • builtin:speech/none: alias to builtin:speech/transcribe.

Response example:

<?xml version="1.0" encoding="UTF-8"?>
<result version="1.32.0">
<interpretation grammar="session:demo-grammar-0" confidence="1.00">
<instance>je voudrais changer trois billets</instance>
<input asr-model="fr.basic" mode="speech" timestamp-start="2020-12-22T11:11:45.620+01:00" timestamp-end="2020-12-22T11:11:47.060+01:00" confidence="1.00" asr-model="fr.basic">je voudrais changer trois billets</input>
</interpretation>
</result>
{
...
"body": {
"asr": {
"transcript": "je voudrais changer trois billets",
"confidence": 0.913001,
"start": 1660046900819,
"end": 1660046901899
},
"nlu": {
"type": "builtin:speech/transcribe",
"value": "je voudrais changer trois billets",
"confidence": 0.913001
},
"grammar_uri": "session:transcribe",
"version": "1.32.0",
"asr_model": "fr.basic"
}
}

Numbers in digit form

Raw ASR with interpretation of numbers in digit form.

Grammar name:

  • builtin:speech/text2num

Response example:

<?xml version="1.0" encoding="UTF-8"?>
<result version="1.32.0">
<interpretation grammar="session:demo-grammar-0" confidence="1.00">
<instance>environ 1575 euros et 28 centimes</instance>
<input asr-model="fr.basic" mode="speech" timestamp-start="2021-02-19T10:20:21.114+01:00" timestamp-end="2021-02-19T10:20:25.224+01:00" confidence="1.00">environ mille cinq cent soixante-quinze euros et vingt-huit centimes</input>
</interpretation>
</result>
{
...
"body": {
"asr": {
"transcript": "environ mille cinq cent soixante-quinze euros et vingt-huit centimes",
"confidence": 0.999625,
"start": 1660052799042,
"end": 1660052802222
},
"nlu": {
"type": "builtin:speech/text2num",
"value": "environ 1575 euros et 28 centimes",
"confidence": 0.9998581
},
"grammar_uri": "session:text2num",
"version": "1.32.0",
"asr_model": "fr.basic"
}
}

Address

At the moment this feature is only available in French and for addresses in France.

Address grammar for postal addresses. This grammar is closed, and is therefore compatible with Hotword mode, but we strongly recommend to use Normal mode as it will allow for partial match, which is useful for example when end-users don't say their zipcode, and you want to ask a confirmation of it with the dedicated builtin.

Response structure

Instead of returning a plain text result, this grammar returns a structured document with different fields for street number, street, city, postal code and complement. It's quite robust.

In order to validate a complete-match, it is necessary that these 3 main elements are expressed (in any order):

  • Street
  • City
  • Zip code

Expressing only one or two of these three elements will give you a partial-match. A fourth (non-main) element can also be interpreted: complement, such as building, staircase...

The language model is based on real address dictionaries. So you have to avoid imaginary addresses if you want to measure the performance of the grammar.

Grammar name:

  • builtin:speech/postal_address

Response example:

<?xml version="1.0" encoding="UTF-8"?>
<result version="1.32.0">
<interpretation grammar="session:demo-grammar-0" confidence="1.00">
<instance>
<address>
<number>37</number>
<street>rue du docteur leroy</street>
<zipcode>72000</zipcode>
<city>le mans</city>
<complement>5ème étage</complement>
</address>
</instance>
<input asr-model="fr.address" mode="speech" timestamp-start="2021-03-31T11:12:12.606+02:00" timestamp-end="2021-03-31T11:12:16.716+02:00" confidence="1.00">alors j'habite au trente-sept rue du docteur leroy au mans et euh le code postal c'est soixante-douze mille au cinquième étage</input>
</interpretation>
</result>
{
...
"body": {
"asr": {
"transcript": "trente-sept rue du docteur leroy soixante-douze mille le mans au cinquième étage",
"confidence": 1.0,
"start": 1660048475421,
"end": 1660048478721
},
"nlu": {
"type": "builtin:speech/postal_address",
"value": {
"number": "37",
"street": "rue du docteur leroy",
"zipcode": "72000",
"city": "le mans",
"complement": "5ème étage"
},
"confidence": 1.0
},
"grammar_uri": "session:postal_address",
"version": "1.32.0",
"asr_model": "fr.address"
}
}

Modes

Normal mode

In normal mode it is possible not to give the 3 main elements: street, city and zip code. If one or more are missing, you will get a partial-match. The no-match will only occur if the ASR is not able to detect anything.

Note that if user says "Charles de Gaulle" it will be a no-match, but "Avenue Charles de Gaulle" will be a partial-match.

Hotword mode

Hotword Mode is available with this grammar, although we recommend to use Normal Mode. If one or more of the 3 main elements are missing, then you will get a no-match. The hotword mode only supports complete or "no-match".

Boolean

The Yes or No grammar. This grammar is closed, and is therefore compatible with Hotword mode.

Is boolean the right builtin for your interaction? If you're asking a closed-ended question, there is always a possibility to reword it to get a boolean answer. If it's an open-ended question check the other builtins.

Analyze the user input to determine if they accept/confirm or refuse/deny.

When the grammar matches, the interpretation contains either "yes" or "no".

Grammar name:

  • builtin:speech/boolean

Response example:

<?xml version="1.0" encoding="UTF-8"?>
<result version="1.32.0">
<interpretation grammar="session:demo-grammar-0" confidence="1.00">
<instance>yes</instance>
<input asr-model="fr.basic" mode="speech" timestamp-start="2020-12-22T11:11:45.620+01:00" timestamp-end="2020-12-22T11:11:47.060+01:00" confidence="1.00">euh tout à fait</input>
</interpretation>
</result>
{
...
"body": {
"asr": {
"transcript": "euh tout \u00e0 fait",
"confidence": 0.964623,
"start": 1660049133364,
"end": 1660049134144
},
"nlu": {
"type": "builtin:speech/boolean",
"value": true,
"confidence": 0.964623
},
"grammar_uri": "session:boolean",
"version": "1.32.0",
"asr_model": "fr.basic"
}
}

Date

The date grammar is able to parse and understand dates in various formats, including relative dates. This grammar is closed, and is therefore compatible with Hotword mode.

It returns a structured object, with a flag indicating if the date is valid (actually exists) or not. You can "hint" the grammar to favor past dates or future dates when part of the date is implied by the user (e.g. "on Monday", "on 10/10"…).

About the modes:

  • In normal mode: it is possible not to give the 3 elements: day, month and year. If the year is missing, the grammar will assume the nearest one that satisfies the time "hint". If the day or month cannot be found, then you will get a partial-match. The no-match) will only occur if the ASR is not able to detect anything.
  • In hotword mode: if the day or the month are missing and cannot be inferred, then you will get a no-match. The hotword mode only supports complete or "no-match". There is no partial-match with hotword mode.

About the time hint:

  • Use the parameter time_hint as shown in the example below
  • past value, which is the default one, will favor dates in the past
  • future value will favor dates in the future

Note that time_hint=future will return a date in the past, for example if the user says a date that is explicitly in the past. At the moment this feature is only fully supported in French, and partially supported (numeric dates only) in English.

Grammar name:

  • builtin:speech/date, which is equivalent to builtin:speech/date?time_hint=past
  • builtin:speech/date?time_hint=future

Response example:

<?xml version="1.0" encoding="UTF-8"?>
<result version="1.32.0">
<interpretation grammar="session:demo-grammar-0" confidence="1.00">
<instance>
<date>
<day>10</day>
<month>10</month>
<year>2010</year>
<valid>yes</valid>
</date>
</instance>
<input asr-model="fr.basic" mode="speech" timestamp-start="2022-02-01T14:58:19.257+00:00" timestamp-end="2022-02-01T14:58:20.817+00:00" confidence="1.00">le dix dix dix</input>
</interpretation>
</result>
{
...
"body": {
"asr": {
"transcript": "le dix dix dix",
"confidence": 0.999965,
"start": 1660052481361,
"end": 1660052482741
},
"nlu": {
"type": "builtin:speech/date",
"value": {
"day": 10,
"month": 10,
"year": 2010,
"valid": true
},
"confidence": 0.9999654
},
"grammar_uri": "session:date",
"version": "1.32.0",
"asr_model": "fr.basic"
}
}

Examples of fully understood dates in French (Complete-match):

  • cinq avril mille neuf cent quatre-vingt
  • quinze mai quatre-vingt
  • trois août dix-neuf cent soixante
  • onze onze cinquante (result depends on the time hint)
  • vingt zéro six mille neuf cent six
  • aujourd'hui
  • demain
  • hier
  • après demain
  • avant hier
  • lundi prochain
  • mardi dernier
  • dans cinq jours
  • il y a huit jours
  • lundi (result depends on the time hint)
  • 10 août (result depends on the time hint)

English Both numeric M/D/Y and D/M/Y dates are supported according to the country field of the language code provided in the header speech-language.

If only en is provided, the recognized numeric format defaults to D/M/Y. To recognize the US numeric date format, Speech-language should be en-us.

If the month name is explicitly given, instead of its number, the order does not matter.

  • ten zero six nineteen seventy-eight — different results for en and en-us
  • ten zero nine seventy-eight — different results for en and en-us
  • six nineteen seventy-eight
  • the third of february
  • five april nineteen eighty
  • april five nineteen eighty
  • fifteen may eighty
  • february first
  • today, tomorrow, …
  • the day before yesterday, …
  • monday
  • last monday
  • next friday
  • three days ago
  • in ten days
  • in two weeks

German

  • der dritte zehnte neunzehnhundertneunzig
  • der dritte zehnte neunzig
  • der dritte februar
  • der dreißigste januar neunzehnhundertvierundsiebzig
  • heute
  • morgen
  • übermorgen
  • gestern
  • vorgestern
  • montag
  • letzte dienstag
  • nächsten montag
  • vor drei tagen
  • in fünf tagen
  • in zwei wochen
  • dienstag in drei wochen
  • freitag überwoche

Spanish

  • diez cero seis mil novecientos setenta y ocho
  • diez cero nueve setenta y ocho
  • diez diez diez
  • tres de febrero
  • primero de febrero
  • veintidós de junio de dos mil diecinueve
  • diecisiete de mayo ochenta y nueve
  • hoy
  • mañana
  • pasado mañana
  • ayer
  • anteayer
  • antier
  • lunes pasado
  • próxima lunes
  • lunes que vienes
  • hace tres días
  • dentro de cinco días
  • dentro de dos semanas
  • martes dentro de tres semanas
  • lunes hace tres semanas
  • viernes de la semana que viene
  • viernes de la semana pasada

Examples of dates triggering partial matches:

  • janvier 2015
  • mars 80
  • zéro six soixante-dix-huit
  • en mars (year will be guessed according to the time hint)
  • july 1980

Keyword spotting

Match user input for some keyword from a set you define. The interpretation returns the matched keyword. This grammar is closed, and is therefore compatible with Hotword mode.

This grammar is really useful for example to offer end-users with choices at the beginning of their interaction with the IVR.

Grammar name:

  • builtin:speech/keywords?alternatives= + mutually exclusive keywords separated by |
  • Example: builtin:speech/keywords?alternatives=facture|commande|compte|conseiller

Response example:

<?xml version="1.0" encoding="UTF-8"?>
<result version="1.32.0">
<interpretation grammar="session:demo-grammar-0" confidence="1.00">
<instance>commande</instance>
<input asr-model="fr.basic" mode="speech" timestamp-start="2021-02-19T10:20:21.114+01:00" timestamp-end="2021-02-19T10:20:25.224+01:00" confidence="1.00">
je voudrais euh suivre ma commande
</input>
</interpretation>
</result>
{
...
"body": {
"asr": {
"transcript": "commande",
"confidence": 0.728419,
"start": 1660052654481,
"end": 1660052655021
},
"nlu": {
"type": "builtin:speech/keywords",
"value": "commande",
"confidence": 0.728419
},
"grammar_uri": "session:keywords",
"version": "1.32.0",
"asr_model": "fr.basic"
}
}

License plate

For the moment, This grammar only supports French license plates, in French language.

This grammar listen to the user spelling their license plate and if it recognizes a valid license plate (new or old format), it returns it as a clean string.

Grammar name:

  • builtin:speech/spelling/license_plate
<?xml version="1.0" encoding="UTF-8"?>
<result version="1.32.0">
<interpretation grammar="session:demo-grammar-0" confidence="0.92">
<instance>ac613et</instance>
<input asr-model="fr.spelling" mode="speech" timestamp-start="2021-02-19T10:28:30.294+01:00" timestamp-end="2021-02-19T10:28:32.944+01:00" confidence="0.98">alors c'est euh assez six cent treize e thé</input>
</interpretation>
</result>
{
...
"body": {
"asr": {
"transcript": "alors c'est euh assez six cent treize e thé",
"confidence": 0.976624,
"start": 1660054699202,
"end": 1660054702592
},
"nlu": {
"type": "builtin:speech/spelling/license_plate",
"value": "ac613et",
"confidence": 0.9940537
},
"grammar_uri": "session:spelling/license_plate",
"version": "1.32.0",
"asr_model": "fr.spelling"
}
}

Spelling

With the following grammars, the interpretation forces understanding of letters and numbers (returned in digit form) while filtering out parasite words.

Spelled punctuation and diacritics are supported only with spelling builtins mixed with punctuation and letters with punctuation.

Alphanumeric

Spelling mode for both letters and digits.

Grammar name:

  • builtin:speech/spelling/mixed

Response example:

<?xml version="1.0" encoding="UTF-8"?>
<result version="1.32.0">
<interpretation grammar="session:demo-grammar-0" confidence="0.92">
<instance>r e n e 123</instance>
<input asr-model="fr.spelling" mode="speech" timestamp-start="2021-02-19T10:28:30.294+01:00" timestamp-end="2021-02-19T10:28:32.944+01:00" confidence="0.98">air euh n e accent aigu tiret cent vingt-trois</input>
</interpretation>
</result>
{
...
"body": {
"asr": {
"transcript": "r e n e accent aigu tiret cent vingt-trois",
"confidence": 0.996624,
"start": 1660054699202,
"end": 1660054702592
},
"nlu": {
"type": "builtin:speech/spelling/mixed",
"value": "r e n e 123",
"confidence": 0.9940537
},
"grammar_uri": "session:spelling/mixed",
"version": "1.32.0",
"asr_model": "fr.spelling"
}
}

Alphanumeric plus punctuation and diacritics

This grammar will interpret punctuation (raw return from English ASR "hyphen" will be interpreted as "-"), as well as diacritics (raw return from French ASR "e accent aigu" will be interpreted as "é").

Grammar name:

  • builtin:speech/spelling/mixed_with_punct

Response example:

<?xml version="1.0" encoding="UTF-8"?>
<result version="1.32.0">
<interpretation grammar="session:demo-grammar-0" confidence="0.92">
<instance>r e n é 36 @ g m a i l . c o m</instance>
<input asr-model="fr.spelling" mode="speech" timestamp-start="2021-02-19T10:28:30.294+01:00" timestamp-end="2021-02-19T10:28:32.944+01:00" confidence="0.98">air euh n e accent aigu trente-six arobase g m a i l point c o m</input>
</interpretation>
</result>
{
...
"body": {
"asr": {
"transcript": "r e n e accent aigu trente-six arobase g m a i l point c o m",
"confidence": 0.950509,
"start": 1660121043680,
"end": 1660121050070
},
"nlu": {
"type": "builtin:speech/spelling/mixed_with_punct",
"value": "r e n \u00e9 36 @ g m a i l . c o m",
"confidence": 0.9471425
},
"grammar_uri": "session:spelling/mixed_with_punct",
"version": "1.32.0",
"asr_model": "fr.spelling"
}
}

Please note that since this builtin deals with both alphabetic and numeric characters, spelling in French "deux L" (resp. in English "two L" and so on in German and Spanish) would be interpreted as "2L" not "LL". People sould say "double L" (resp. "doppel L" in German and so on in English and Spanish).

Digits only

Spelling mode restricted to numbers (in digit form) only.

Grammar name:

  • builtin:speech/spelling/digits

Response example:

<?xml version="1.0" encoding="UTF-8"?>
<result version="1.32.0">
<interpretation grammar="session:demo-grammar-0" confidence="0.79">
<instance>1 2</instance>
<input asr-model="fr.spelling" mode="speech" timestamp-start="2021-02-19T10:30:12.684+01:00" timestamp-end="2021-02-19T10:30:17.934+01:00" confidence="0.63">a b c un deux d e f</input>
</interpretation>
</result>
{
...
"body": {
"asr": {
"transcript": "a b c un deux d e f",
"confidence": 0.75647265,
"start": 1660121317162,
"end": 1660121322442
},
"nlu": {
"type": "builtin:speech/spelling/digits",
"value": "1 2",
"confidence": 0.84261
},
"grammar_uri": "session:spelling/digits",
"version": "1.32.0",
"asr_model": "fr.spelling"
}
}

Concerning the grouping of numbers, there are three possibilities:

  • Use of a regex or length parameter: all the digits are grouped and formatted without spaces.
  • No use of a regex or length parameter: no formatting is defined, the grouping is done according to what has been said.
  • Use of separator parameter: formatting will depend on the value given to the parameter.

With this grammar homophones are forced to be interpreted as numbers. For example in English, if raw output of ASR is "too", then it would be forced as "two". In French "de" would become "deux".

Letters only

Spelling mode restricted to letters only.

Grammar name:

  • builtin:speech/spelling/letters

Response example:

<?xml version="1.0" encoding="UTF-8"?>
<result version="1.32.0">
<interpretation grammar="session:demo-grammar-0" confidence="0.91">
<instance>t n c a p b f f</instance>
<input asr-model="fr.spelling" mode="speech" timestamp-start="2021-02-19T10:31:54.664+01:00" timestamp-end="2021-02-19T10:32:06.814+01:00" confidence="0.96">alors t n c a p b f quatre-vingt-dix-huit f cinq dix-sept trente-huit soixante et un trente-trois dix-sept</input>
</interpretation>
</result>
{
...
"body": {
"asr": {
"transcript": "alors t n c a p b f quatre-vingt-dix-huit f cinq dix-sept trente-huit soixante et un trente-trois dix-sept",
"confidence": 0.978481,
"start": 1660133402732,
"end": 1660133409422
},
"nlu": {
"type": "builtin:speech/spelling/letters",
"value": "t n c a p b f f",
"confidence": 0.97240585
},
"grammar_uri": "session:spelling/letters",
"version": "1.32.0",
"asr_model": "fr.spelling"
}
}

Letters plus punctuation and diacritics

This grammar will interpret punctuation (raw return from English ASR "hyphen" will be interpreted as "-"), as well as diacritics (raw return from French ASR "e accent aigu" will be interpreted as "é").

This grammar is the one you're looking for in order to interpret names.

Grammar name:

  • builtin:speech/spelling/letters_with_punct

Response example:

<?xml version="1.0" encoding="UTF-8"?>
<result version="1.32.0">
<interpretation grammar="session:demo-grammar-0" confidence="0.92">
<instance>r e n é - m ü l l e r @ g m a i l . c o m</instance>
<input asr-model="fr.spelling" mode="speech" timestamp-start="2021-02-19T10:28:30.294+01:00" timestamp-end="2021-02-19T10:28:32.944+01:00" confidence="0.98">r e n e accent aigu tiret m u tréma deux l e r arobase g m a i l point c o m</input>
</interpretation>
</result>
{
...
"body": {
"asr": {
"transcript": "r e n e accent aigu tiret m u tréma deux l e r arobase g m a i l point c o m",
"confidence": 0.978481,
"start": 1660133402732,
"end": 1660133409422
},
"nlu": {
"type": "builtin:speech/spelling/letters_with_punc",
"value": "r e n é - m ü l l e r @ g m a i l . c o m",
"confidence": 0.97240585
},
"grammar_uri": "session:spelling/letters_with_punc",
"version": "1.32.0",
"asr_model": "fr.spelling"
}
}

Diacritics

Grammars alphanumeric with diacritics and letters with diacritics support, in French, the following diacritics and punctuation signs:

  • ' apostrophe

  • : deux-points

  • espace

  • . point

  • ! point d'exclamation

  • ? point d'interrogation

  • ; point-virgule

  • - tiret (hyphen-minus)

  • , virgule

  • @ arobase, at...

  • / slash, barre oblique

  • _ underscore, tiret du bas, souligné

  • # dièse, hashtag

  • + plus

  • espace, plus loin

  • * astérisque

  • combined with the previous spelled letter:

    • ˋ accent grave
    • ˊ accent aigu
    • ^ accent circonflexe
    • ¸ cédille
    • ~ tilde
    • ¨ tréma

English

  • ' apostrophe
  • ! exclamation mark
  • @ at, commercial at, at sign
  • ? question mark
  • + plus
  • . full stop, dot
  • space
  • - hyphen, minus, dash
  • : colon
  • ; semicolon
  • , comma
  • # hash, hashtag
  • / slash, stroke, solidus
  • _ underscore, underline, low line, low dash
  • & ampersand
  • * asterisk

German

  • + pluszeichen

  • leerraum, raum

  • , komma

  • ; semicolon

  • . punkt

  • / schrägstrich, federstrich, pinselstrich

  • - minuszeichen, gedankenstrich

  • : doppelpunkt

  • ' apostroph

  • _ underscore, unterstich

  • # hash, hashtag, doppelkreuz

  • ? fragezeichen

  • ! ausrufezeichen

  • @ at, at-zeichen

  • combined with the previous spelled letter:

    • ¨ umlaut
    • ~ tilde

Spanish

  • + más

  • espacio

  • , coma

  • ; punto y coma

  • . punto

  • - guion

  • : dos puntos

  • ' apóstrofo

  • # numeral, sostenido, almohadilla, hashtag

  • ! signo de exclamación, signo de exclamación de apertura, signo de admiración, signo de admiración de apertura

  • ¡ signo de admiración de cierre, signo de exclamación de cierre

  • ? signo de interrogación, signo de interrogación de apertura

  • ¿ signo de interrogación de cierre

  • @ arroba, at

  • / barra

  • * asterisco

  • combined with the previous spelled letter

    • ¨ diéresis
    • ~ tilde (but ñ is said eñe)
    • ``` accento grave
    • ´ accento agudo

Additional options

All of the above spelling grammars (mixed, digits and letters) accept additional options to narrow down the interpretation.

Thanks to these options, you will be able to interpret phone numbers, customer identifiers, social security numbers, licence plates and many other entities.

Options sep, regex and length parameters are mutually exclusive.

Separator

Specify the letter and number separator instead of default space.

Grammar names with sep option:

  • builtin:speech/spelling/mixed?sep= + character or none
  • builtin:speech/spelling/mixed_with_punct?sep= + character or none
  • builtin:speech/spelling/digits?sep= + character or none
  • builtin:speech/spelling/letters?sep= + character or none
  • builtin:speech/spelling/letters_with_punct?sep= + character or none

Response example for builtin:speech/spelling/mixed_with_punct?sep=-:

<?xml version="1.0" encoding="UTF-8"?>
<result version="1.32.0">
<interpretation grammar="session:demo-grammar-0" confidence="0.92">
<instance>m-a-r-c-o- -p-o-l-o</instance>
<input asr-model="fr.spelling" mode="speech" timestamp-start="2021-02-19T10:28:30.294+01:00" timestamp-end="2021-02-19T10:28:32.944+01:00" confidence="0.98">m a r c o espace p o l o</input>
</interpretation>
</result>
{
...
"body": {
"asr": {
"transcript": "m a r c o espace p o l o",
"confidence": 0.953763,
"start": 1660134300642,
"end": 1660134305862
},
"nlu": {
"type": "builtin:speech/spelling/mixed_with_punct",
"value": "m-a-r-c-o- -p-o-l-o",
"confidence": 0.9537628
},
"grammar_uri": "session:spelling/mixed_with_punct_hyphen",
"version": "1.32.0",
"asr_model": "fr.spelling"
}
}

Response example for builtin:speech/spelling/mixed_with_punct?sep=none:

<?xml version="1.0" encoding="UTF-8"?>
<result version="1.32.0">
<interpretation grammar="session:demo-grammar-0" confidence="0.92">
<instance>marco polo</instance>
<input asr-model="fr.spelling" mode="speech" timestamp-start="2021-02-19T10:28:30.294+01:00" timestamp-end="2021-02-19T10:28:32.944+01:00" confidence="0.98">m a r c o espace p o aile o</input>
</interpretation>
</result>
{
...
"body": {
"asr": {
"transcript": "m a r c o espace p o l o",
"confidence": 0.946848,
"start": 1660134392460,
"end": 1660134396120
},
"nlu": {
"type": "builtin:speech/spelling/mixed_with_punct",
"value": "marco polo",
"confidence": 0.9468482
},
"grammar_uri": "session:spelling/mixed_with_punc_none",
"version": "1.32.0",
"asr_model": "fr.spelling"
}
}

Length

Forces the interpretation as a single word of the given length. This parameter makes the grammar a closed one, and is therefore compatible with Hotword mode.

Grammar names with length option:

  • builtin:speech/spelling/mixed?length= + integer
  • builtin:speech/spelling/mixed_with_punct?length= + integer
  • builtin:speech/spelling/digits?length= + integer
  • builtin:speech/spelling/letters?length= + integer
  • builtin:speech/spelling/letters_with_punct?length= + integer

Response example for builtin:speech/spelling/digits?length=5:

<?xml version="1.0" encoding="UTF-8"?>
<result version="1.32.0">
<interpretation grammar="session:demo-grammar-0" confidence="1.00">
<instance>35170</instance>
<input asr-model="fr.spelling" mode="speech" timestamp-start="2021-02-19T10:33:36.303+01:00" timestamp-end="2021-02-19T10:33:38.193+01:00" confidence="1.00">trente-cinq mille cent soixante-dix</input>
</interpretation>
</result>
{
...
"body": {
"asr": {
"transcript": "trente-cinq mille cent soixante-dix",
"confidence": 0.999745,
"start": 1660134567738,
"end": 1660134569658
},
"nlu": {
"type": "builtin:speech/spelling/digits",
"value": "35170",
"confidence": 0.99974525
},
"grammar_uri": "session:spelling/digits_5",
"version": "1.32.0",
"asr_model": "fr.spelling"
}
}

In Normal Mode you would receive:

  • A Partial Match if the result is inferior to the expected length,
  • A Match if the result is equal to the expected length,
  • A No Match if the result is superior to the expected length.

If you're looking for a ZipCode interpretation, please have a look at our dedicated grammar.

If you're looking for a phone number, the spelling digits grammar with a specific length is what you're looking for.

Regex

The interpretation returns the regular expression match as a single word. This parameter makes the grammar a closed one, and is therefore compatible with Hotword mode.

Partial matches are supported in normal mode.

The regex syntax we use is detailed on a dedicated page

Grammar names with regex option:

  • builtin:speech/spelling/mixed?regex= + pattern
  • builtin:speech/spelling/mixed_with_punct?regex= + pattern
  • builtin:speech/spelling/digits?regex= + pattern
  • builtin:speech/spelling/letters?regex= + pattern
  • builtin:speech/spelling/letters_with_punct?regex= + pattern

Response example for builtin:speech/spelling/mixed?regex=[a-z]{2}[0-9]{9}[a-z]{2}:

<?xml version="1.0" encoding="UTF-8"?>
<result version="1.32.0">
<interpretation grammar="session:demo-grammar-0" confidence="0.98">
<instance>bf969352528jd</instance>
<input asr-model="fr.spelling" mode="speech" timestamp-start="2021-02-19T10:35:20.474+01:00" timestamp-end="2021-02-19T10:35:30.014+01:00" confidence="0.98">b f neuf six neuf trois cinq deux cinq deux huit j d</input>
</interpretation>
</result>
{
...
"body": {
"asr": {
"transcript": "b f neuf six neuf trois cinq de cinq de huit j d",
"confidence": 0.73629,
"start": 1660135693642,
"end": 1660135701532
},
"nlu": {
"type": "builtin:speech/spelling/mixed",
"value": "bf969352528jd",
"confidence": 0.9021617
},
"grammar_uri": "session:spelling_mixed_regex",
"version": "1.32.0",
"asr_model": "fr.spelling"
}
}

Looking to interpret licence plates? We have a dedicated builtin in French. In English, that's the grammar you're looking for:

  • For UK licence plates, the regex pattern would be [a-z]{2}[0-9]{2}[a-z]{3}

Note that this pattern is quite straightforward but could be improved. For example in the UK Z cannot be part of the two first letters.

Clarifications on homophones

When using spelling grammars, we may encounter homophones that can confuse the expected results. For example, "mon numéro DE colis" may be understood and transformed into the number "2". In most cases, homophones are corrected and not added to the results. Some homophones may not be corrected yet, we will add new rules as we encounter these cases. Do not hesitate to give us feedback about this.

Zipcode

For now only postal code for France, Spain and Germany are supported, in all languages.

The speech-language country code is used to identify the country.

For example, if it is fr_FR, the grammar will try to match a postal code for France, told in French. But you can also mix: with en_DE, the grammar will try to match a postal code for Germany, told in English.

The interpretation returns a 5 digits ZIP codes that are splittable as 2+3 digits, as it can be found in France, Spain, Germany or USA. This grammar is closed and is therefore compatible with Hotword mode.

To conform to MRCPv2 RFC, note that:

Grammar name:

  • builtin:speech/spelling/zipcode
  • builtin:speech/zipcode alias to builtin:speech/spelling/zipcode

Response example:

<?xml version="1.0" encoding="UTF-8"?>
<result version="1.32.0">
<interpretation grammar="session:demo-grammar-0" confidence="1.00">
<instance>35170</instance>
<input asr-model="fr.spelling" mode="speech" timestamp-start="2021-02-19T10:37:17.755+01:00" timestamp-end="2021-02-19T10:37:20.125+01:00" confidence="1.00">trente-cinq cent soixante-dix</input>
</interpretation>
</result>
{
...
"body": {
"asr": {
"transcript": "trente-cinq cent soixante-dix",
"confidence": 0.999979,
"start": 1660136485940,
"end": 1660136487590
},
"nlu": {
"type": "builtin:speech/spelling/zipcode",
"value": "35170",
"confidence": 0.999969
},
"grammar_uri": "session:spelling/zipcode",
"version": "1.32.0",
"asr_model": "fr.spelling"
}
}

Beware that this builtin is not universal. For other patterns than the one described above, we recommend you use spelling digits with length option instead.