Detect Language
Detect language of the user input
The Language Detection feature is used to identify the language of the user inputs.
Accessing Detected Language
To access the detected language in the user's conversation, you can use the Input
class's identifiedLanguage
attribute.
Example:
List of supported languages
Locale Object
The identified language itself is saved in Input.identifiedLanguage.value
as a Locale
object, meaning you can use any attribute of the Locale
objects, such as:
language
- Language code in the ISO 639 standard (e.g. "en").displayLanguage
- Human readable language name (e.g. "English").
Example
In this example, we first check if a language was detected in the user input, and whether the language identifier model is confident enough about the result. If yes, we can take appropriate action based on the user input language.
Last updated