subtitle-correction
npx skills add https://github.com/sugarforever/01coder-agent-skills --skill subtitle-correction
Agent 安装分布
Skill 文档
Subtitle Correction Skill
This skill corrects speech recognition errors in subtitle files while strictly preserving timeline information.
Interactive Workflow
Step 1: Request Terminology from User
IMPORTANT: Before starting any correction, ALWAYS ask the user for domain-specific terms.
Prompt the user with:
å¨å¼å§ä¿®æ£ä¹åï¼è¯·æä¾ä¸äºå
³é®æ¯è¯ï¼å¸®å©ææ´åç¡®å°è¯å«åä¿®æ£è¯é³è¯å«é误ï¼
1. **䏿åè¯**ï¼äººåãåçåã产ååçï¼å¦ï¼AnthropicãClaudeï¼
2. **ææ¯æ¯è¯**ï¼æ¡æ¶ãåºãå·¥å
·åç§°ï¼å¦ï¼LangChainãOpenAIãPyTorchï¼
3. **é¢åè¯æ±**ï¼è¡ä¸ç¹å®è¯æ±ï¼å¦ï¼checkpointerãmiddlewareãruntimeï¼
4. **å
¶ä»å
³é®è¯**ï¼è§é¢ä¸é¢ç¹åºç°çéè¦è¯æ±
请ç¨éå·åéï¼ä¾å¦ï¼`LangChain, Agent, OpenAI, checkpointer`
For English users:
Before I begin correction, please provide key terms to help me accurately identify speech recognition errors:
1. **Proper nouns**: Names, brands, products (e.g., Anthropic, Claude)
2. **Technical terms**: Frameworks, libraries, tools (e.g., LangChain, PyTorch)
3. **Domain vocabulary**: Industry-specific terms (e.g., checkpointer, middleware)
4. **Other keywords**: Important words that appear frequently
Please separate with commas, e.g.: `LangChain, Agent, OpenAI, checkpointer`
Step 2: Confirm Understanding
After receiving terms, confirm by:
- Listing the terms received
- Identifying the likely domain/context (AI/ML tutorial, web dev, etc.)
- Asking if there are any additional terms before proceeding
Example response:
æ¶å°ä»¥ä¸æ¯è¯ï¼
- ææ¯æ¡æ¶ï¼LangChain, LangGraph, OpenAI
- ææ¯æ¦å¿µï¼Agent, checkpointer, runtime
çèµ·æ¥è¿æ¯ä¸ä¸ª LangChain æºè½ä½å¼åçæç¨è§é¢ã
è¿æå
¶ä»éè¦è¡¥å
çæ¯è¯åï¼å¦ææ²¡æï¼æå°å¼å§ä¿®æ£åå¹ã
Step 3: Process with Terms
Use the provided terms to:
- Build a mental model of expected vocabulary
- Identify likely speech recognition errors
- Apply consistent corrections throughout
When User Doesn’t Provide Terms
If user says “æ²¡æ” / “no” / “ç´æ¥å¼å§”:
- Proceed with correction using built-in patterns
- Flag uncertain corrections for user review
- After completion, ask if any terms were missed
Core Workflow
- Read the subtitle file – Load the .srt file provided by the user
- Identify error patterns – Recognize common speech recognition mistakes
- Apply corrections – Fix errors while preserving timestamps exactly
- Output corrected file – Return or save based on user’s context
Strict Rules
Timeline Preservation
- NEVER modify timestamps – Keep all
00:00:00,000 --> 00:00:00,000lines exactly as-is - NEVER change subtitle numbering – Preserve sequence numbers
- NEVER merge or split subtitle entries – One-to-one correspondence
Error Categories
1. Phonetic Errors (åé³å/è°é³é误)
Common in Chinese speech recognition:
- ä¼è¯ â ç»ç» (huìhuà )
- å æ°æ® â æºæ°æ® (yuán shùjù)
- æ¬è¯¾ â æ¬ç§ (bÄnkè)
- ç¤ºä¾ â äºä¾ (shìlì)
- å®è·µ â æ¶é´ (shÃjià n)
2. Technical Term Errors
Speech recognition often fails on:
- Framework names: LangChain, LangGraph, OpenAI, PyTorch, TensorFlow
- Programming terms: API, SDK, runtime, checkpointer, middleware
- Code identifiers: snake_case names, function names, class names
3. English-Chinese Mixed Content
- Luncheon/lunch â langchain
- open EI/open Email â OpenAI
- land GRAPH â langgraph
- a memory Server â MemorySaver
4. Code-Related Terms
Convert spoken descriptions to proper format:
- “underscore” â “_” in variable names
- “dot” â “.” in method calls
- Recognize camelCase, snake_case, PascalCase patterns
User-Provided Terminology
When users provide a terminology list, use it as the primary reference for corrections:
ç¨æ·æä¾çæ¯è¯ï¼LangChain,Agent,OpenAI,LangGraph
These terms indicate:
- Expected proper spellings of technical terms
- Context about the content domain
- Hints for identifying speech recognition errors
Processing Strategy
For Long Files (>200 lines)
- Process in chunks using
view_rangeparameter - Maintain context across chunks
- Build complete corrected file incrementally
For Technical Content
- Identify the domain (AI/ML, web dev, etc.)
- Build mental model of expected terminology
- Apply domain-specific corrections consistently
Quality Checks
Before outputting:
- Verify all timestamps unchanged
- Verify subtitle count unchanged
- Check terminology consistency throughout
- Ensure no orphaned corrections (partial fixes)
Common Correction Patterns
Chinese AI/ML Course Content
| Error | Correction | Context |
|---|---|---|
| èç¬/èå·/Lantern | LangChain | Framework name |
| ç»ç» | ä¼è¯ | Session/conversation |
| æ/tour | tool | Tool concept |
| checkpointç»ä»¶ | checkpointerç»ä»¶ | Memory component |
| æºæ°æ® | å æ°æ® | Metadata |
| 大约模å | 大模å | Large model |
| ä¸é´é® | ä¸é´ä»¶ | Middleware |
Code Identifiers
| Spoken | Written |
|---|---|
| user underscore 001 | user_001 |
| thread underscore id | thread_id |
| create underscore agent | create_agent |
| runtime dot state | runtime.state |
Output Format
When saving, use -corrected suffix:
- Input:
filename.srt - Output:
filename-corrected.srt
Validation Script
Use scripts/subtitle_tool.py to validate and analyze subtitle files:
# Validate corrected file preserves structure
python scripts/subtitle_tool.py validate original.srt corrected.srt
# Show word-level diff with colored output (default, changes only)
python scripts/subtitle_tool.py diff original.srt corrected.srt
# Show ALL entries (changed and unchanged) in terminal
python scripts/subtitle_tool.py diff original.srt corrected.srt --all
# Generate HTML diff report (recommended for review)
python scripts/subtitle_tool.py diff original.srt corrected.srt --html report.html
# Show simple line-based diff (original/corrected lines)
python scripts/subtitle_tool.py diff original.srt corrected.srt --simple
# Disable colors for piping to files
python scripts/subtitle_tool.py diff original.srt corrected.srt --no-color
# Analyze file for potential speech recognition errors
python scripts/subtitle_tool.py analyze input.srt --terms "LangChain,OpenAI"
Diff Output Formats
Terminal Output (Default)
Shows word-level changes with colors:
[1] 00:00:01,500 --> 00:00:04,500
ä»å¤©æä»¬æ¥å¦ä¹ [-Luncheon-]{+LangChain+}æ¡æ¶
[3] 00:00:08,000 --> 00:00:12,500
æä»¬å¯ä»¥ç¨å®æ¥å建[-ç»ç»-]{+ä¼è¯+}åºç¨ç¨åº
[-deleted-]– Text removed (shown in red in terminal){+added+}– Text added (shown in green in terminal)- Use
--allto show unchanged entries too
HTML Report (Recommended for Review)
Generates a full comparison report with:
- All entries displayed (changed and unchanged)
- Side-by-side columns: Original | Corrected | Diff View
- Visual highlighting: Red strikethrough for deletions, green for additions
- Summary statistics: Total entries, changed count, unchanged count
- Jump links: Quick navigation to changed entries
- Change indicators: Yellow dot marks changed rows
python scripts/subtitle_tool.py diff original.srt corrected.srt --html diff_report.html
Then open diff_report.html in a browser.
Validation Workflow
- Before correction: Run
analyzeto identify potential errors - After correction: Run
validateto ensure structural integrity - Review changes: Run
diff --html report.htmlto generate a visual comparison report
Validation Checks
- Entry count matches original
- All timestamps unchanged
- All sequence numbers preserved
- No formatting corruption
Example Interaction
Interaction 1: User uploads file without terms
User: 帮æä¿®æ£è¿ä¸ªå广件
Claude:
å¨å¼å§ä¿®æ£ä¹åï¼è¯·æä¾ä¸äºå
³é®æ¯è¯ï¼å¸®å©ææ´åç¡®å°è¯å«è¯é³è¯å«é误ï¼
1. **䏿åè¯**ï¼äººåãåçåã产åå
2. **ææ¯æ¯è¯**ï¼æ¡æ¶ãåºãå·¥å
·åç§°
3. **é¢åè¯æ±**ï¼è¡ä¸ç¹å®è¯æ±
4. **å
¶ä»å
³é®è¯**ï¼è§é¢ä¸é¢ç¹åºç°çéè¦è¯æ±
请ç¨éå·åéï¼ä¾å¦ï¼`LangChain, Agent, OpenAI`
User: LangChain, Agent, OpenAI, LangGraph, checkpointer
Claude:
æ¶å°ä»¥ä¸æ¯è¯ï¼
- ææ¯æ¡æ¶ï¼LangChain, LangGraph, OpenAI
- ææ¯æ¦å¿µï¼Agent, checkpointer
è¿æ¯ä¸ä¸ª LangChain ç¸å
³çææ¯æç¨ãè¿æè¡¥å
åï¼
User: 没æäºï¼å¼å§å§
Claude: [Proceeds with correction workflow]
Interaction 2: User provides terms upfront
User: 帮æä¿®æ£åå¹ï¼æ¯è¯ï¼LangChain, OpenAI, Agent
Claude: [Confirms terms, then proceeds directly]
Correction Process
- Read uploaded .srt file
- Run
analyzeto identify potential errors - Apply corrections using provided terms as primary reference
- Run
validateto confirm structural integrity - Save corrected file with
-correctedsuffix - Generate diff report and present summary of changes
- Offer HTML report: Ask user if they want an HTML diff report for easier review
Output: Provide categorized summary of corrections made.
After completion, prompt user:
ä¿®æ£å®æï¼æå¯ä»¥çæä¸ä¸ª HTML 差弿¥åï¼æ¹ä¾¿æ¨å¨æµè§å¨ä¸æ¥çææä¿®æ¹ã
éè¦çæ HTML æ¥ååï¼
Correction complete! I can generate an HTML diff report for easier review in your browser.
Would you like me to generate the HTML report?