Skip to content

Feedback: speech-to-text-pre-recorded-audio-set-language-manually

Original URL: https://www.assemblyai.com/docs/speech-to-text/pre-recorded-audio/set-language-manually
Category: speech-to-text
Generated: 05/08/2025, 4:24:46 pm


Generated: 05/08/2025, 4:24:45 pm

Documentation Analysis: “Set Language Manually”

Section titled “Documentation Analysis: “Set Language Manually””

This documentation provides basic functionality examples but lacks critical context and user guidance. The code examples are comprehensive across languages, but the explanations are minimal and miss important user considerations.

Critical gaps:

  • No list or examples of supported language codes in the main content
  • No explanation of what happens when language is set incorrectly
  • Missing performance/accuracy implications of manual vs. auto-detection
  • No guidance on when to use manual language setting vs. automatic detection
  • Missing error handling examples for unsupported language codes

Add this section:

## When to Use Manual Language Setting
Use manual language setting when:
- You know the dominant language of your audio (>70% of content)
- You need consistent processing for similar audio files
- You want to avoid auto-detection overhead for better performance
**Note:** Setting an incorrect language code may significantly reduce transcription accuracy.

Current issues:

  • “Dominant language” is mentioned but not defined
  • No explanation of what the language code format represents (ISO codes)
  • Missing context about mixed-language content handling

Improved introduction:

# Set Language Manually
When you know the primary language spoken in your audio file, you can specify it using the `language_code` parameter. This uses ISO 639-1 language codes (e.g., "en" for English, "es" for Spanish, "fr" for French).
**Important:** The specified language should represent at least 70% of the spoken content for optimal accuracy. For mixed-language content, consider using [automatic language detection](/docs/speech-to-text/pre-recorded-audio/automatic-language-detection) instead.

Current problems:

  • All examples use “es” (Spanish) - not intuitive for English-speaking users
  • No example showing the difference in output
  • Missing common language codes in examples

Add practical examples:

## Common Language Codes
| Language | Code |
|----------|------|
| English (US) | `en_us` |
| Spanish | `es` |
| French | `fr` |
| German | `de` |
| Chinese (Mandarin) | `zh` |
| Japanese | `ja` |
[View all supported languages →](/docs/speech-to-text/pre-recorded-audio/supported-languages)
## Example: English vs Spanish Detection
```python
# For English audio
config = aai.TranscriptionConfig(language_code="en_us")
# For Spanish audio
config = aai.TranscriptionConfig(language_code="es")
### 4. Improved Structure
**Reorganize content:**
```markdown
# Set Language Manually
## Overview
[Improved introduction from above]
## When to Use Manual Language Setting
[When to use section from above]
## Setting the Language Code
[Current code examples with improvements]
## Common Language Codes
[Table from above]
## Error Handling
[New section below]
## Related Features
- [Automatic Language Detection](/docs/automatic-language-detection)
- [Supported Languages](/docs/supported-languages)
- [Language Confidence Scores](/docs/language-confidence)

Current pain points and solutions:

Pain Point 1: Users don’t know what happens with wrong language codes

## Error Handling
If you specify an unsupported language code, you'll receive an error:
```json
{
"error": "Language code 'xx' is not supported"
}

If you specify a supported but incorrect language (e.g., “es” for English audio), transcription will proceed but with significantly reduced accuracy.

**Pain Point 2:** No guidance on troubleshooting poor results
```markdown
## Troubleshooting
**Poor transcription quality?**
- Verify the language code matches your audio content
- Ensure the specified language represents >70% of spoken content
- Try [automatic language detection](/docs/automatic-language-detection) for mixed-language content

Pain Point 3: Code examples are too verbose for the simple concept

  • Solution: Add a “Quick Start” section with minimal examples
  • Solution: Move complex polling logic to a separate “Complete Example” section

Add practical context:

## Performance Impact
Manual language setting:
- ✅ Faster processing (skips language detection)
- ✅ More predictable results for known content
- ❌ Requires prior knowledge of audio language
- ❌ Poor results if language is incorrect
Automatic detection:
- ✅ Works with unknown or mixed content
- ✅ No prior knowledge required
- ❌ Slightly slower processing
- ❌ May occasionally misidentify language

Improve code organization:

## Quick Example
```python
import assemblyai as aai
config = aai.TranscriptionConfig(language_code="en_us")
transcript = aai.Transcriber(config=config).transcribe(audio_file)
print(transcript.text)
Complete examples for all languages

[Current detailed code blocks here]

```

The documentation needs significant expansion to provide context, guidance, and better user experience. The core functionality is documented, but users need more information to make informed decisions and troubleshoot issues effectively.