subtitle-correction

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Subtitle 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:
  1. Listing the terms received
  2. Identifying the likely domain/context (AI/ML tutorial, web dev, etc.)
  3. Asking if there are any additional terms before proceeding
Example response:
收到以下术语:
- 技术框架:LangChain, LangGraph, OpenAI
- 技术概念:Agent, checkpointer, runtime

看起来这是一个 LangChain 智能体开发的教程视频。

还有其他需要补充的术语吗?如果没有,我将开始修正字幕。
收到术语后,通过以下方式确认:
  1. 列出收到的术语
  2. 识别可能的领域/场景(如AI/ML教程、Web开发等)
  3. 询问用户是否有补充术语后再开始处理
示例回复:
收到以下术语:
- 技术框架:LangChain, LangGraph, OpenAI
- 技术概念:Agent, checkpointer, runtime

看起来这是一个 LangChain 智能体开发的教程视频。

还有其他需要补充的术语吗?如果没有,我将开始修正字幕。

Step 3: Process with Terms

步骤3:结合术语处理

Use the provided terms to:
  1. Build a mental model of expected vocabulary
  2. Identify likely speech recognition errors
  3. Apply consistent corrections throughout
使用用户提供的术语:
  1. 构建预期词汇的认知模型
  2. 识别可能的语音识别错误
  3. 在整个字幕中应用一致的修正

When User Doesn't Provide Terms

当用户未提供术语时

If user says "没有" / "no" / "直接开始":
  1. Proceed with correction using built-in patterns
  2. Flag uncertain corrections for user review
  3. After completion, ask if any terms were missed
如果用户回复"没有" / "no" / "直接开始":
  1. 使用内置规则进行修正
  2. 将不确定的修正标记出来供用户审核
  3. 完成后询问用户是否有遗漏的术语

Core Workflow

核心工作流程

  1. Read the subtitle file - Load the .srt file provided by the user
  2. Identify error patterns - Recognize common speech recognition mistakes
  3. Apply corrections - Fix errors while preserving timestamps exactly
  4. Output corrected file - Return or save based on user's context
  1. 读取字幕文件 - 加载用户提供的.srt文件
  2. 识别错误模式 - 识别常见的语音识别错误
  3. 应用修正 - 修正错误并严格保留时间戳
  4. 输出修正后的文件 - 根据用户场景返回或保存文件

Strict Rules

严格规则

Timeline Preservation

时间轴保留

  • NEVER modify timestamps - Keep all
    00:00:00,000 --> 00:00:00,000
    lines exactly as-is
  • 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,LangGraph
These 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行)

  1. Process in chunks using
    view_range
    parameter
  2. Maintain context across chunks
  3. Build complete corrected file incrementally
  1. 使用
    view_range
    参数分块处理
  2. 保持块间上下文连贯性
  3. 逐步构建完整的修正文件

For Technical Content

技术内容

  1. Identify the domain (AI/ML, web dev, etc.)
  2. Build mental model of expected terminology
  3. Apply domain-specific corrections consistently
  1. 识别领域(如AI/ML、Web开发等)
  2. 构建预期术语的认知模型
  3. 应用一致的领域特定修正

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课程内容

ErrorCorrectionContext
蓝犬/蓝卷/LanternLangChainFramework name
绘画会话Session/conversation
拖/tourtoolTool concept
checkpoint组件checkpointer组件Memory component
源数据元数据Metadata
大约模型大模型Large model
中间键中间件Middleware
错误内容修正内容场景
蓝犬/蓝卷/LanternLangChain框架名称
绘画会话会话/对话场景
拖/tourtool工具概念
checkpoint组件checkpointer组件内存组件
源数据元数据元数据术语
大约模型大模型大模型术语
中间键中间件中间件术语

Code Identifiers

代码标识符

SpokenWritten
user underscore 001user_001
thread underscore idthread_id
create underscore agentcreate_agent
runtime dot stateruntime.state
口语描述正确写法
user underscore 001user_001
thread underscore idthread_id
create underscore agentcreate_agent
runtime dot stateruntime.state

Output Format

输出格式

When saving, use
-corrected
suffix:
  • Input:
    filename.srt
  • Output:
    filename-corrected.srt
保存时使用
-corrected
后缀:
  • 输入:
    filename.srt
  • 输出:
    filename-corrected.srt

Validation Script

验证脚本

Use
scripts/subtitle_tool.py
to validate and analyze subtitle files:
bash
undefined
使用
scripts/subtitle_tool.py
验证和分析字幕文件:
bash
undefined

Validate 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"
undefined
python scripts/subtitle_tool.py analyze input.srt --terms "LangChain,OpenAI"
undefined

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
    --all
    to show unchanged entries too
以彩色显示单词级修改:
[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.html
Then open
diff_report.html
in a browser.
生成完整的对比报告,包含:
  • 所有条目(修改和未修改的)
  • 并列列:原文 | 修正后 | 差异视图
  • 视觉高亮:删除内容用红色删除线,新增内容用绿色
  • 统计摘要:总条目数、修改条目数、未修改条目数
  • 跳转链接:快速导航到修改的条目
  • 修改标记:黄色圆点标记修改的行
bash
python scripts/subtitle_tool.py diff original.srt corrected.srt --html diff_report.html
然后在浏览器中打开
diff_report.html
查看。

Validation Workflow

验证工作流程

  1. Before correction: Run
    analyze
    to identify potential errors
  2. After correction: Run
    validate
    to ensure structural integrity
  3. Review changes: Run
    diff --html report.html
    to generate a visual comparison report
  1. 修正前:运行
    analyze
    识别潜在错误
  2. 修正后:运行
    validate
    确保结构完整性
  3. 审核修改:运行
    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

修正流程

  1. Read uploaded .srt file
  2. Run
    analyze
    to identify potential errors
  3. Apply corrections using provided terms as primary reference
  4. Run
    validate
    to confirm structural integrity
  5. Save corrected file with
    -corrected
    suffix
  6. Generate diff report and present summary of changes
  7. 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?
  1. 读取上传的.srt文件
  2. 运行
    analyze
    识别潜在错误
  3. 以用户提供的术语为主要参考进行修正
  4. 运行
    validate
    确认结构完整性
  5. 保存带
    -corrected
    后缀的修正文件
  6. 生成差异报告并展示修改摘要
  7. 提供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?