Code switching handles conversations where speakers switch languages mid-utterance or across turns. Gladia can detect and transcribe the active language dynamically, and annotate results with the detected languages code.
For best accuracy and latency, provide a small set of expected languages.
Avoid listing dozens of similar languages.
How to use code switching ?
Enable code switching in the session configuration:
{
"encoding": "wav/pcm",
"sample_rate": 16000,
"bit_depth": 16,
"channels": 1,
"language_config": {
"languages": ["en", "de", "fr"],
"code_switching": true
}
}
When enabled, transcript messages include the detected language per utterance and per word. Use the transcript message schema for details.
Do not enable code_switching with an empty languages list. When no
languages are specified, the language detector evaluates every utterance
against 100+ supported languages, leading to frequent misdetections -
especially between similar-sounding languages.
Recommendations
- Limit the number of languages to those you expect.
- Combine with custom vocabulary per language for domain terms.