Code Switching
Transcribe audio containing multiple languages with code switching detection. This feature enables accurate transcription of conversations where speakers naturally switch between languages during conversations.
Code Switching and How It Works
Code switching occurs when speakers alternate between languages in dialogue.
Our code switching feature detects and transcribes these language transitions, maintaining accuracy across languages. When you submit a file with code-switching dialogue, our model can transcribe both languages, with optimal performance for English paired with another language.
Supported Language Pairs
Code switching performance varies by language pair.
Optimal performance:
- English + Spanish
- English + German
Other supported languages:
While additional languages are supported for code switching, optimal results typically require the non-English language to be dominant in the audio. For English-dominant content with other languages, standard single-language transcription may be more appropriate.
We highly recommend testing sample code switching files with your specific audio to assess performance and evaluate outputs. We also recommend using an LLM to correct and fine-tune our model’s outputs.
Manually Setting Language Codes
To manually set the language codes, you can use the language_codes
parameter. A max of two language codes can be set and one code must be "en"
. For example, if your file contains both English and Spanish, it would be "language_codes": ["en", "es"]
.
Use Automatic Language Detection
To use automatic language detection for code switching, set language_detection
to True
. Then, within language_detection_options
set code_switching
to True
.
Optionally, you can set code_switching_confidence_threshold
to a number between 0 and 1. This will only use identified languages above this threshold. A max of two languages can be identified.
Code Switching Confidence Threshold
By default, the code_switching_confidence_threshold
parameter is set to 0.3
. If you would like to disable this, make sure to set this parameter to 0
.
Example API Response
When enabling code switching with automatic language detection, the two detected language codes with the highest confidence and their confidence will be included in the transcript JSON.
Example output
Here’s what you can expect from a properly configured code-switching transcription:
Input: Audio containing English and Spanish conversation
The transcription maintains accuracy across both languages without attempting to force everything into a single language.
Troubleshooting
If your audio contains primarily one language with only occasional words from another language, standard single-language transcription may be more appropriate than code-switching mode.
Related features
- Supported Languages - View all available language options
- Speaker Diarization - Identify different speakers in multi-speaker conversations
- Custom Vocabulary - Boost transcription accuracy using LeMUR