Quick reference for the transcript cleanup module. For complete details, see transcript-cleanup-spec.md.
# API Call
GET /videos/{video_id}/transcript?format=cleaned
# Result: Standard cleanup applied (conservative fillers, basic punctuation)# API Call
GET /videos/{video_id}/transcript?format=cleaned&profile=aggressive
# Profiles: minimal, standard, aggressive, youtube_captions, whisper_output,
# presentation, technical, accessibility# API Call
POST /transcripts/{transcript_id}/cleanup
# Body
{
"config": {
"remove_fillers": true,
"filler_level": 2,
"add_punctuation": true,
"capitalize": true
}
}| Setting | Default | Description |
|---|---|---|
normalize_unicode |
true |
Apply NFC normalization |
normalize_whitespace |
true |
Fix spacing issues |
remove_special_tokens |
true |
Remove [MUSIC], etc. |
preserve_sound_events |
false |
Keep sound markers |
| Setting | Default | Description |
|---|---|---|
add_punctuation |
true |
Add periods, question marks |
punctuation_mode |
"rule-based" |
"none", "rule-based", "model-based" |
capitalize |
true |
Capitalize sentences |
fix_all_caps |
true |
Fix ALL CAPS text |
| Setting | Default | Description |
|---|---|---|
remove_fillers |
true |
Enable filler removal |
filler_level |
1 |
0=off, 1=conservative, 2=moderate, 3=aggressive |
Filler Levels:
- Level 0: No removal
- Level 1: Remove
um,uh,eronly - Level 2: Add
you know,I mean, stutters - Level 3: Add
like,sort of,kind of
| Setting | Default | Description |
|---|---|---|
segment_sentences |
true |
Split on sentence boundaries |
merge_short_segments |
true |
Merge close segments |
min_segment_length_ms |
1000 |
Min segment duration |
max_gap_for_merge_ms |
500 |
Max gap to merge |
speaker_format |
"structured" |
"inline", "dialogue", "structured" |
| Setting | Default | Description |
|---|---|---|
detect_hallucinations |
true |
Mark repetitive segments |
language_specific_rules |
true |
Use language-aware rules |
| Profile | Fillers | Punctuation | Segmentation | Use Case |
|---|---|---|---|---|
| minimal | None | None | None | Preserve original |
| standard | Level 1 | Rule-based | Yes | General purpose (default) |
| aggressive | Level 3 | Rule-based + internal | Yes | Maximum cleanup |
| youtube_captions | Level 2 | Rule-based | Yes | YouTube auto-captions |
| whisper_output | Level 1 | Rule-based | Merge only | Whisper transcripts |
| presentation | None | Rule-based + internal | Yes | Talks, lectures |
| technical | Level 1 | Minimal | Merge only | Code, technical content |
| accessibility | Level 2 | Rule-based + internal | No merge | Screen readers |
Input: "[MUSIC] um hello everyone uh welcome to the show"
Output: "Hello everyone, welcome to the show."
Input: "what time is it"
Output: "What time is it?"
# Level 1
Input: "um hello uh world"
Output: "Hello world."
# Level 2
Input: "I I I think you know it's good"
Output: "I think it's good."
# Level 3
Input: "so like I think it's kind of good"
Output: "I think it's good."
Input:
[
{"speaker": "SPEAKER_00", "text": "um hello everyone", "start_ms": 0, "end_ms": 1500},
{"speaker": "SPEAKER_00", "text": "welcome", "start_ms": 1500, "end_ms": 3000},
{"speaker": "SPEAKER_01", "text": "thanks", "start_ms": 3500, "end_ms": 5000}
]
Output (dialogue format):
Speaker 1: Hello everyone, welcome.
Speaker 2: Thanks.
Add to .env:
# Enable cleanup
CLEANUP_ENABLED=true
# Text normalization
CLEANUP_NORMALIZE_UNICODE=true
CLEANUP_NORMALIZE_WHITESPACE=true
CLEANUP_REMOVE_SPECIAL_TOKENS=true
# Punctuation
CLEANUP_PUNCTUATION_MODE=rule-based
CLEANUP_ADD_SENTENCE_PUNCTUATION=true
CLEANUP_CAPITALIZE_SENTENCES=true
# De-filler
CLEANUP_REMOVE_FILLERS=true
CLEANUP_FILLER_LEVEL=1
# Segmentation
CLEANUP_SEGMENT_BY_SENTENCES=true
CLEANUP_MERGE_SHORT_SEGMENTS=true
CLEANUP_SPEAKER_FORMAT=structured
# Advanced
CLEANUP_DETECT_HALLUCINATIONS=trueGET /videos/{video_id}/transcript?format=cleaned&profile=standardQuery Parameters:
format:raw,cleaned, orformattedprofile: Profile name (optional)
Response:
{
"video_id": "uuid",
"segments": [
{
"start_ms": 1000,
"end_ms": 3500,
"text_raw": "um hello everyone",
"text_cleaned": "Hello everyone.",
"speaker_label": "Speaker 1",
"sentence_boundary": true
}
],
"cleanup_config": {...},
"stats": {
"fillers_removed": 1,
"punctuation_added": 1
}
}POST /transcripts/{transcript_id}/cleanup
Content-Type: application/json
{
"config": {
"remove_fillers": true,
"filler_level": 3,
"add_punctuation": true
}
}GET /cleanup/profilesResponse:
{
"profiles": [
"minimal",
"standard",
"aggressive",
"youtube_captions",
"whisper_output",
"presentation",
"technical",
"accessibility"
]
}GET /cleanup/profiles/{profile_name}from transcript_create_client import TranscriptCreateClient
from transcript_create_client.models import CleanupConfig
client = TranscriptCreateClient(api_key="your_api_key")
# Use predefined profile
transcript = await client.get_transcript(
video_id="video-uuid",
format="cleaned",
profile="standard"
)
# Custom configuration
config = CleanupConfig(
remove_fillers=True,
filler_level=3,
add_punctuation=True,
capitalize=True
)
transcript = await client.cleanup_transcript(
transcript_id="transcript-uuid",
config=config
){
"remove_fillers": true,
"filler_level": 1,
"add_punctuation": true,
"capitalize": true,
"segment_sentences": false
}{
"remove_fillers": true,
"filler_level": 3,
"add_punctuation": true,
"add_internal_punctuation": true,
"capitalize": true,
"fix_all_caps": true,
"segment_sentences": true,
"speaker_format": "dialogue"
}{
"normalize_unicode": false,
"remove_fillers": false,
"add_punctuation": true,
"capitalize": false,
"fix_all_caps": false,
"segment_sentences": false
}Solution: Use lower filler level or minimal profile
# Instead of
{"filler_level": 3}
# Use
{"filler_level": 1}
# or
profile="minimal"Solution: Enable internal punctuation
{
"add_punctuation": true,
"add_internal_punctuation": true
}Solution: Change speaker_format
# For plain text output with names
{"speaker_format": "dialogue"}
# For API/JSON with structure
{"speaker_format": "structured"}
# For inline markers
{"speaker_format": "inline"}Solution: Use technical profile or disable capitalization fixes
profile="technical"
# or
{
"fix_all_caps": false,
"normalize_unicode": false,
"language_specific_rules": false
}Solution: Adjust segmentation thresholds
# For shorter segments
{
"min_segment_length_ms": 500,
"max_gap_for_merge_ms": 300
}
# For longer segments
{
"min_segment_length_ms": 2000,
"max_gap_for_merge_ms": 1000
}- Use Caching: Run optional database migration for faster repeated access
- Use Profiles: Predefined profiles are faster than custom configs
- Batch Processing: Process multiple transcripts in background jobs
- Choose Right Level: Higher filler levels = more processing time
Typical Performance:
- 1000 segments: ~300-500ms (standard profile)
- 10,000 segments: ~3-5s (standard profile)
- Cached results: <100ms API response
curl -X POST http://localhost:8000/cleanup/test \
-H "Content-Type: application/json" \
-d '{
"text": "um hello everyone [MUSIC] welcome to the show",
"profile": "standard"
}'Response:
{
"input": "um hello everyone [MUSIC] welcome to the show",
"output": "Hello everyone, welcome to the show.",
"profile": "standard",
"transformations": [
"removed_filler: um",
"removed_special_token: [MUSIC]",
"added_capitalization",
"added_punctuation: ."
]
}- Complete Spec: transcript-cleanup-spec.md
- Profiles Guide: cleanup-profiles.md
- Examples & Tests: cleanup-examples.md
For issues or questions:
- Check examples in
cleanup-examples.md - Review profile descriptions in
cleanup-profiles.md - See full spec in
transcript-cleanup-spec.md - Report bugs: GitHub Issues
Last Updated: 2025-11-02