subtitle-correction
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSubtitle Correction Skill
字幕修正Skill
This skill corrects speech recognition errors in subtitle files while strictly preserving timeline information.
本Skill可修正字幕文件中的语音识别错误,同时严格保留时间轴信息。
Interactive Workflow
交互式工作流程
Step 1: Request Terminology from User
步骤1:向用户请求术语
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`重要提示:在开始任何修正之前,务必向用户请求领域特定术语。
向用户发送以下提示:
在开始修正之前,请提供一些关键术语,帮助我更准确地识别和修正语音识别错误:
1. **专有名词**:人名、品牌名、产品名等(如:Anthropic、Claude)
2. **技术术语**:框架、库、工具名称(如:LangChain、OpenAI、PyTorch)
3. **领域词汇**:行业特定词汇(如:checkpointer、middleware、runtime)
4. **其他关键词**:视频中频繁出现的重要词汇
请用逗号分隔,例如:`LangChain, Agent, OpenAI, checkpointer`针对英文用户:
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
步骤2:确认理解
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 智能体开发的教程视频。
还有其他需要补充的术语吗?如果没有,我将开始修正字幕。收到术语后,通过以下方式确认:
- 列出收到的术语
- 识别可能的领域/场景(如AI/ML教程、Web开发等)
- 询问用户是否有补充术语后再开始处理
示例回复:
收到以下术语:
- 技术框架:LangChain, LangGraph, OpenAI
- 技术概念:Agent, checkpointer, runtime
看起来这是一个 LangChain 智能体开发的教程视频。
还有其他需要补充的术语吗?如果没有,我将开始修正字幕。Step 3: Process with Terms
步骤3:结合术语处理
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
如果用户回复"没有" / "no" / "直接开始":
- 使用内置规则进行修正
- 将不确定的修正标记出来供用户审核
- 完成后询问用户是否有遗漏的术语
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
- 读取字幕文件 - 加载用户提供的.srt文件
- 识别错误模式 - 识别常见的语音识别错误
- 应用修正 - 修正错误并严格保留时间戳
- 输出修正后的文件 - 根据用户场景返回或保存文件
Strict Rules
严格规则
Timeline Preservation
时间轴保留
- NEVER modify timestamps - Keep all lines exactly as-is
00:00:00,000 --> 00:00:00,000 - NEVER change subtitle numbering - Preserve sequence numbers
- NEVER merge or split subtitle entries - One-to-one correspondence
- 绝不修改时间戳 - 完全保留所有格式的行
00:00:00,000 --> 00:00:00,000 - 绝不修改字幕编号 - 保留序列编号
- 绝不合并或拆分字幕条目 - 保持一对一对应关系
Error Categories
错误分类
1. Phonetic Errors (同音字/谐音错误)
1. 语音错误(同音字/谐音错误)
Common in Chinese speech recognition:
- 会话 ↔ 绘画 (huìhuà)
- 元数据 ↔ 源数据 (yuán shùjù)
- 本课 ↔ 本科 (běnkè)
- 示例 ↔ 事例 (shìlì)
- 实践 ↔ 时间 (shíjiàn)
中文语音识别中常见错误:
- 会话 ↔ 绘画 (huìhuà)
- 元数据 ↔ 源数据 (yuán shùjù)
- 本课 ↔ 本科 (běnkè)
- 示例 ↔ 事例 (shìlì)
- 实践 ↔ 时间 (shíjiàn)
2. Technical Term Errors
2. 技术术语错误
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
语音识别经常在以下内容上出错:
- 框架名称:LangChain, LangGraph, OpenAI, PyTorch, TensorFlow
- 编程术语:API, SDK, runtime, checkpointer, middleware
- 代码标识符:snake_case命名、函数名、类名
3. English-Chinese Mixed Content
3. 中英文混合内容
- Luncheon/lunch → langchain
- open EI/open Email → OpenAI
- land GRAPH → langgraph
- a memory Server → MemorySaver
- Luncheon/lunch → langchain
- open EI/open Email → OpenAI
- land GRAPH → langgraph
- a memory Server → MemorySaver
4. Code-Related Terms
4. 代码相关术语
Convert spoken descriptions to proper format:
- "underscore" → "_" in variable names
- "dot" → "." in method calls
- Recognize camelCase, snake_case, PascalCase patterns
将口语描述转换为正确格式:
- "underscore" → 变量名中的"_"
- "dot" → 方法调用中的"."
- 识别camelCase、snake_case、PascalCase命名模式
User-Provided Terminology
用户提供的术语
When users provide a terminology list, use it as the primary reference for corrections:
用户提供的术语:LangChain,Agent,OpenAI,LangGraphThese terms indicate:
- Expected proper spellings of technical terms
- Context about the content domain
- Hints for identifying speech recognition errors
当用户提供术语列表时,将其作为修正的主要参考:
用户提供的术语:LangChain,Agent,OpenAI,LangGraph这些术语表明:
- 技术术语的正确拼写
- 内容的领域场景
- 识别语音识别错误的线索
Processing Strategy
处理策略
For Long Files (>200 lines)
长文件(>200行)
- Process in chunks using parameter
view_range - Maintain context across chunks
- Build complete corrected file incrementally
- 使用参数分块处理
view_range - 保持块间上下文连贯性
- 逐步构建完整的修正文件
For Technical Content
技术内容
- Identify the domain (AI/ML, web dev, etc.)
- Build mental model of expected terminology
- Apply domain-specific corrections consistently
- 识别领域(如AI/ML、Web开发等)
- 构建预期术语的认知模型
- 应用一致的领域特定修正
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
中文AI/ML课程内容
| Error | Correction | Context |
|---|---|---|
| 蓝犬/蓝卷/Lantern | LangChain | Framework name |
| 绘画 | 会话 | Session/conversation |
| 拖/tour | tool | Tool concept |
| checkpoint组件 | checkpointer组件 | Memory component |
| 源数据 | 元数据 | Metadata |
| 大约模型 | 大模型 | Large model |
| 中间键 | 中间件 | Middleware |
| 错误内容 | 修正内容 | 场景 |
|---|---|---|
| 蓝犬/蓝卷/Lantern | LangChain | 框架名称 |
| 绘画 | 会话 | 会话/对话场景 |
| 拖/tour | tool | 工具概念 |
| checkpoint组件 | checkpointer组件 | 内存组件 |
| 源数据 | 元数据 | 元数据术语 |
| 大约模型 | 大模型 | 大模型术语 |
| 中间键 | 中间件 | 中间件术语 |
Code Identifiers
代码标识符
| Spoken | Written |
|---|---|
| user underscore 001 | user_001 |
| thread underscore id | thread_id |
| create underscore agent | create_agent |
| runtime dot state | runtime.state |
| 口语描述 | 正确写法 |
|---|---|
| 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 suffix:
-corrected- Input:
filename.srt - Output:
filename-corrected.srt
保存时使用后缀:
-corrected- 输入:
filename.srt - 输出:
filename-corrected.srt
Validation Script
验证脚本
Use to validate and analyze subtitle files:
scripts/subtitle_tool.pybash
undefined使用验证和分析字幕文件:
scripts/subtitle_tool.pybash
undefinedValidate corrected file preserves structure
Validate corrected file preserves structure
python scripts/subtitle_tool.py validate original.srt corrected.srt
python scripts/subtitle_tool.py validate original.srt corrected.srt
Show word-level diff with colored output (default, changes only)
Show word-level diff with colored output (default, changes only)
python scripts/subtitle_tool.py diff original.srt corrected.srt
python scripts/subtitle_tool.py diff original.srt corrected.srt
Show ALL entries (changed and unchanged) in terminal
Show ALL entries (changed and unchanged) in terminal
python scripts/subtitle_tool.py diff original.srt corrected.srt --all
python scripts/subtitle_tool.py diff original.srt corrected.srt --all
Generate HTML diff report (recommended for review)
Generate HTML diff report (recommended for review)
python scripts/subtitle_tool.py diff original.srt corrected.srt --html report.html
python scripts/subtitle_tool.py diff original.srt corrected.srt --html report.html
Show simple line-based diff (original/corrected lines)
Show simple line-based diff (original/corrected lines)
python scripts/subtitle_tool.py diff original.srt corrected.srt --simple
python scripts/subtitle_tool.py diff original.srt corrected.srt --simple
Disable colors for piping to files
Disable colors for piping to files
python scripts/subtitle_tool.py diff original.srt corrected.srt --no-color
python scripts/subtitle_tool.py diff original.srt corrected.srt --no-color
Analyze file for potential speech recognition errors
Analyze file for potential speech recognition errors
python scripts/subtitle_tool.py analyze input.srt --terms "LangChain,OpenAI"
undefinedpython scripts/subtitle_tool.py analyze input.srt --terms "LangChain,OpenAI"
undefinedDiff 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
我们可以用它来创建[-绘画-]{+会话+}应用程序- - Text removed (shown in red in terminal)
[-deleted-] - - Text added (shown in green in terminal)
{+added+} - Use to show unchanged entries too
--all
以彩色显示单词级修改:
[1] 00:00:01,500 --> 00:00:04,500
今天我们来学习[-Luncheon-]{+LangChain+}框架
[3] 00:00:08,000 --> 00:00:12,500
我们可以用它来创建[-绘画-]{+会话+}应用程序- - 被删除的文本(终端中显示为红色)
[-deleted-] - - 新增的文本(终端中显示为绿色)
{+added+} - 使用参数可显示未修改的条目
--all
HTML Report (Recommended for Review)
HTML报告(推荐用于审核)
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
bash
python scripts/subtitle_tool.py diff original.srt corrected.srt --html diff_report.htmlThen open in a browser.
diff_report.html生成完整的对比报告,包含:
- 所有条目(修改和未修改的)
- 并列列:原文 | 修正后 | 差异视图
- 视觉高亮:删除内容用红色删除线,新增内容用绿色
- 统计摘要:总条目数、修改条目数、未修改条目数
- 跳转链接:快速导航到修改的条目
- 修改标记:黄色圆点标记修改的行
bash
python scripts/subtitle_tool.py diff original.srt corrected.srt --html diff_report.html然后在浏览器中打开查看。
diff_report.htmlValidation Workflow
验证工作流程
- Before correction: Run to identify potential errors
analyze - After correction: Run to ensure structural integrity
validate - Review changes: Run to generate a visual comparison report
diff --html report.html
- 修正前:运行识别潜在错误
analyze - 修正后:运行确保结构完整性
validate - 审核修改:运行生成可视化对比报告
diff --html report.html
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
交互1:用户上传文件但未提供术语
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]
用户:帮我修正这个字幕文件
Claude:
在开始修正之前,请提供一些关键术语,帮助我更准确地识别和修正语音识别错误:
1. **专有名词**:人名、品牌名、产品名
2. **技术术语**:框架、库、工具名称
3. **领域词汇**:行业特定词汇
4. **其他关键词**:视频中频繁出现的重要词汇
请用逗号分隔,例如:`LangChain, Agent, OpenAI`用户:LangChain, Agent, OpenAI, LangGraph, checkpointer
Claude:
收到以下术语:
- 技术框架:LangChain, LangGraph, OpenAI
- 技术概念:Agent, checkpointer
这是一个 LangChain 相关的技术教程。还有补充吗?用户:没有了,开始吧
Claude:[执行修正工作流程]
Interaction 2: User provides terms upfront
交互2:用户提前提供术语
User: 帮我修正字幕,术语:LangChain, OpenAI, Agent
Claude: [Confirms terms, then proceeds directly]
用户:帮我修正字幕,术语:LangChain, OpenAI, Agent
Claude:[确认术语后直接开始修正]
Correction Process
修正流程
- Read uploaded .srt file
- Run to identify potential errors
analyze - Apply corrections using provided terms as primary reference
- Run to confirm structural integrity
validate - Save corrected file with suffix
-corrected - 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?- 读取上传的.srt文件
- 运行识别潜在错误
analyze - 以用户提供的术语为主要参考进行修正
- 运行确认结构完整性
validate - 保存带后缀的修正文件
-corrected - 生成差异报告并展示修改摘要
- 提供HTML报告:询问用户是否需要生成HTML差异报告以便于审核
输出:提供分类的修改摘要。
完成后提示用户:
修正完成!我可以生成一个 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?