Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Language

Focus mode
Language - Amazon Lex

The following discussion applies to language identifiers applied to grammars. For more information, see Language in the Speech recognition grammar specification version 1 W3C recommendation.

By default a grammar is a single language document with a language identifier provided in the language declaration in the grammar header. All tokens within that grammar, unless otherwise declared, will be handled according to the grammar's language. Grammar-level language declarations are not supported.

In the following example:

  1. The grammar header declaration for the language "en-US" is supported by Amazon Lex V2.

  2. Item-level language attachment (highlighted in red) is not supported. Amazon Lex V2 throws a validation error if a language attachment is different from the header declaration.

<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN" "http://www.w3.org/TR/speech-grammar/grammar.dtd"> <!-- the default grammar language is US English --> <grammar xmlns="http://www.w3.org/2001/06/grammar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd" xml:lang="en-US" version="1.0"> <!-- single language attachment to tokens "yes" inherits US English language "oui" is Canadian French language --> <rule id="yes"> <one-of> <item>yes</item> <item xml:lang="fr-CA">oui</item> </one-of> </rule> <!-- Single language attachment to an expansion --> <rule id="people1"> <one-of xml:lang="fr-CA"> <item>Michel Tremblay</item> <item>André Roy</item> </one-of> </rule> </grammar>
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.