A Python-based tool for cleaning and correcting SRT (SubRip Subtitle) caption files. Designed for processing ceremony recordings and graduation videos with intelligent text matching and name correction.
- Filler Word Removal: Automatically removes common filler words (uh, um, you know, etc.)
- Script Matching: Matches captions against a reference script using fuzzy matching (85% similarity threshold)
- Name Correction: Corrects graduate names using pattern matching
- Batch Processing: Handles entire SRT files efficiently
- Review Logging: Generates detailed logs of corrections made
- Python 3.x
- Standard library only (no external dependencies)
- Clone this repository
- No additional dependencies required - uses Python standard library
python3 srt_cleaner_script.py- input.srt - The SRT caption file to be cleaned
- ceremony_script.txt - Reference script for matching (one line per statement)
- graduate_names.txt - List of graduate names (one per line)
- cleaned_output.srt - Cleaned and corrected caption file
- review_log.txt - Detailed log of all corrections made
Edit the constants at the top of srt_cleaner_script.py:
SRT_FILE = "input.srt" # Input SRT file
SCRIPT_FILE = "ceremony_script.txt" # Reference script
NAMES_FILE = "graduate_names.txt" # Graduate names
OUTPUT_FILE = "cleaned_output.srt" # Output fileCustomize the filler words to remove:
FILLER_WORDS = {"uh", "um", "you know", "okay", "alright", "all right", "let's do it again"}- Load Resources: Reads script lines, graduate names, and SRT blocks
- Text Cleaning: Removes filler words and normalizes text
- Script Matching: Uses
difflib.SequenceMatcherfor fuzzy matching (>85% similarity) - Name Correction: Pattern-matches and corrects graduate names
- Output Generation: Creates cleaned SRT file with proper formatting
Input:
1
00:00:01,000 --> 00:00:03,000
Uh, welcome everyone, um, to the ceremony
Output:
1
00:00:01,000 --> 00:00:03,000
Welcome everyone to the ceremony
srt-cleaner/
├── srt_cleaner_script.py # Main cleaning script
├── srt-cleaner-project.py # Alternative version
├── input.srt # Input caption file
├── ceremony_script.txt # Reference script
├── graduate_names.txt # Names database
├── cleaned_output.srt # Output file
└── review_log.txt # Correction log
- Graduation ceremony videos
- Conference recordings
- Educational content
- Professional presentations
- Any video content requiring accurate captions
Contributions are welcome! Please ensure:
- Code follows Python PEP 8 style guidelines
- Functions include docstrings
- Changes are tested with sample SRT files
See LICENSE file for details.
- Matching threshold of 85% balances accuracy and flexibility
- Name correction uses partial matching (first 3 characters) for fuzzy matching
- All text comparisons are case-insensitive for better matching