transcript-fixer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTranscript Fixer
转录文本修正工具
Correct speech-to-text transcription errors through dictionary-based rules, AI-powered corrections, and automatic pattern detection. Build a personalized knowledge base that learns from each correction.
通过基于字典的规则、AI驱动的修正以及自动模式检测来修正语音转文本的转录错误。构建可从每次修正中学习的个性化知识库。
When to Use This Skill
何时使用该工具
- Correcting ASR/STT errors in meeting notes, lectures, or interviews
- Building domain-specific correction dictionaries
- Fixing Chinese/English homophone errors or technical terminology
- Collaborating on shared correction knowledge bases
- 修正会议记录、讲座或采访中的ASR/STT错误
- 构建特定领域的修正字典
- 修复中英同音异义词错误或专业术语问题
- 协作构建共享的修正知识库
Prerequisites
前置条件
Python execution must use - never use system Python directly.
uvIf is not installed:
uvbash
undefinedPython执行必须使用 - 切勿直接使用系统Python。
uv若未安装:
uvbash
undefinedmacOS/Linux
macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
curl -LsSf https://astral.sh/uv/install.sh | sh
Windows PowerShell
Windows PowerShell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
undefinedpowershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
undefinedQuick Start
快速开始
Recommended: Use Enhanced Wrapper (auto-detects API key, opens HTML diff):
bash
undefined推荐:使用增强版封装器(自动检测API密钥,打开HTML差异对比):
bash
undefinedFirst time: Initialize database
首次使用:初始化数据库
uv run scripts/fix_transcription.py --init
uv run scripts/fix_transcription.py --init
Process transcript with enhanced UX
以增强用户体验处理转录文本
uv run scripts/fix_transcript_enhanced.py input.md --output ./corrected
The enhanced wrapper automatically:
- Detects GLM API key from shell configs (checks lines near `ANTHROPIC_BASE_URL`)
- Moves output files to specified directory
- Opens HTML visual diff in browser for immediate feedback
**Alternative: Use Core Script Directly**:
```bashuv run scripts/fix_transcript_enhanced.py input.md --output ./corrected
增强版封装器会自动:
- 从Shell配置中检测GLM API密钥(检查`ANTHROPIC_BASE_URL`附近的行)
- 将输出文件移动到指定目录
- 在浏览器中打开HTML可视化差异对比,以便即时反馈
**替代方案:直接使用核心脚本**:
```bash1. Set API key (if not auto-detected)
1. 设置API密钥(若未自动检测到)
export GLM_API_KEY="<api-key>" # From https://open.bigmodel.cn/
export GLM_API_KEY="<api-key>" # 从https://open.bigmodel.cn/获取
2. Add common corrections (5-10 terms)
2. 添加常用修正词条(5-10个)
uv run scripts/fix_transcription.py --add "错误词" "正确词" --domain general
uv run scripts/fix_transcription.py --add "错误词" "正确词" --domain general
3. Run full correction pipeline
3. 运行完整修正流水线
uv run scripts/fix_transcription.py --input meeting.md --stage 3
uv run scripts/fix_transcription.py --input meeting.md --stage 3
4. Review learned patterns after 3-5 runs
4. 运行3-5次后查看学习到的模式
uv run scripts/fix_transcription.py --review-learned
**Output files**:
- `*_stage1.md` - Dictionary corrections applied
- `*_stage2.md` - AI corrections applied (final version)
- `*_对比.html` - Visual diff (open in browser for best experience)
**Generate word-level diff** (recommended for reviewing corrections):
```bash
uv run scripts/generate_word_diff.py original.md corrected.md output.htmlThis creates an HTML file showing word-by-word differences with clear highlighting:
- 🔴 → 🟢
japanese 3 pro(complete word replacements)Gemini 3 Pro - Easy to spot exactly what changed without character-level noise
uv run scripts/fix_transcription.py --review-learned
**输出文件**:
- `*_stage1.md` - 已应用字典修正
- `*_stage2.md` - 已应用AI修正(最终版本)
- `*_对比.html` - 可视化差异对比(在浏览器中打开以获得最佳体验)
**生成逐词差异对比**(推荐用于审核修正内容):
```bash
uv run scripts/generate_word_diff.py original.md corrected.md output.html该命令会生成一个HTML文件,显示逐词差异并带有清晰高亮:
- 🔴 → 🟢
japanese 3 pro(完整词汇替换)Gemini 3 Pro - 无需关注字符级别的冗余信息,轻松定位所有修改内容
Example Session
示例流程
Input transcript ():
meeting.md今天我们讨论了巨升智能的最新进展。
股价系统需要优化,目前性能不够好。After Stage 1 ():
meeting_stage1.md今天我们讨论了具身智能的最新进展。 ← "巨升"→"具身" corrected
股价系统需要优化,目前性能不够好。 ← Unchanged (not in dictionary)After Stage 2 ():
meeting_stage2.md今天我们讨论了具身智能的最新进展。
框架系统需要优化,目前性能不够好。 ← "股价"→"框架" corrected by AILearned pattern detected:
✓ Detected: "股价" → "框架" (confidence: 85%, count: 1)
Run --review-learned after 2 more occurrences to approve输入转录文本 ():
meeting.md今天我们讨论了巨升智能的最新进展。
股价系统需要优化,目前性能不够好。阶段1后 ():
meeting_stage1.md今天我们讨论了具身智能的最新进展。 ← "巨升"→"具身" 已修正
股价系统需要优化,目前性能不够好。 ← 未修改(不在字典中)阶段2后 ():
meeting_stage2.md今天我们讨论了具身智能的最新进展。
框架系统需要优化,目前性能不够好。 ← "股价"→"框架" 由AI修正检测到学习模式:
✓ 检测到: "股价" → "框架"(置信度: 85%, 出现次数: 1)
再出现2次后运行--review-learned以确认Core Workflow
核心工作流
Three-stage pipeline stores corrections in :
~/.transcript-fixer/corrections.db- Initialize (first time):
uv run scripts/fix_transcription.py --init - Add domain corrections:
--add "错误词" "正确词" --domain <domain> - Process transcript:
--input file.md --stage 3 - Review learned patterns: and
--review-learnedhigh-confidence suggestions--approve
Stages: Dictionary (instant, free) → AI via GLM API (parallel) → Full pipeline
Domains: , , , , or custom names including Chinese (e.g., , )
Learning: Patterns appearing ≥3 times at ≥80% confidence move from AI to dictionary
generalembodied_aifinancemedical火星加速器具身智能See for detailed workflows, for complete CLI reference, and for collaboration patterns.
references/workflow_guide.mdreferences/script_parameters.mdreferences/team_collaboration.md三阶段流水线将修正内容存储在中:
~/.transcript-fixer/corrections.db- 初始化(首次使用):
uv run scripts/fix_transcription.py --init - 添加特定领域修正词条:
--add "错误词" "正确词" --domain <domain> - 处理转录文本:
--input file.md --stage 3 - 审核学习到的模式: 并
--review-learned高置信度建议--approve
阶段: 字典修正(即时、免费)→ 基于GLM API的AI修正(并行)→ 完整流水线
领域: 、、、,或包含中文的自定义名称(如、)
学习机制: 出现≥3次且置信度≥80%的模式将从AI库迁移到字典库
generalembodied_aifinancemedical火星加速器具身智能详细工作流请参阅,完整CLI参考请参阅,协作模式请参阅。
references/workflow_guide.mdreferences/script_parameters.mdreferences/team_collaboration.mdCritical Workflow: Dictionary Iteration
关键工作流:字典迭代
MUST save corrections after each fix. This is the skill's core value.
After fixing errors manually, immediately save to dictionary:
bash
uv run scripts/fix_transcription.py --add "错误词" "正确词" --domain generalSee for complete iteration guide with checklist.
references/iteration_workflow.md每次修正后必须保存词条。这是本工具的核心价值。
手动修正错误后,立即将其保存到字典:
bash
uv run scripts/fix_transcription.py --add "错误词" "正确词" --domain general完整迭代指南及检查清单请参阅。
references/iteration_workflow.mdAI Fallback Strategy
AI fallback策略
When GLM API is unavailable (503, network issues), the script outputs marker.
[CLAUDE_FALLBACK]Claude Code should then:
- Analyze the text directly for ASR errors
- Fix using Edit tool
- MUST save corrections to dictionary with
--add
当GLM API不可用时(503错误、网络问题),脚本会输出标记。
[CLAUDE_FALLBACK]此时Claude Code应:
- 直接分析文本中的ASR错误
- 使用编辑工具修正
- 必须通过将修正内容保存到字典
--add
Database Operations
数据库操作
MUST read before any database operations.
references/database_schema.mdQuick reference:
bash
undefined在进行任何数据库操作前,必须阅读。
references/database_schema.md快速参考:
bash
undefinedView all corrections
查看所有修正词条
sqlite3 ~/.transcript-fixer/corrections.db "SELECT * FROM active_corrections;"
sqlite3 ~/.transcript-fixer/corrections.db "SELECT * FROM active_corrections;"
Check schema version
检查架构版本
sqlite3 ~/.transcript-fixer/corrections.db "SELECT value FROM system_config WHERE key='schema_version';"
undefinedsqlite3 ~/.transcript-fixer/corrections.db "SELECT value FROM system_config WHERE key='schema_version';"
undefinedStages
阶段说明
| Stage | Description | Speed | Cost |
|---|---|---|---|
| 1 | Dictionary only | Instant | Free |
| 2 | AI only | ~10s | API calls |
| 3 | Full pipeline | ~10s | API calls |
| 阶段 | 描述 | 速度 | 成本 |
|---|---|---|---|
| 1 | 仅使用字典 | 即时 | 免费 |
| 2 | 仅使用AI | ~10秒 | API调用费用 |
| 3 | 完整流水线 | ~10秒 | API调用费用 |
Bundled Resources
捆绑资源
Scripts:
- - Initialize shared virtual environment (run once, optional)
ensure_deps.py - - Enhanced wrapper (recommended for interactive use)
fix_transcript_enhanced.py - - Core CLI (for automation)
fix_transcription.py - - Generate word-level diff HTML for reviewing corrections
generate_word_diff.py - - Bulk import example
examples/bulk_import.py
References (load as needed):
- Critical: (read before DB operations),
database_schema.md(dictionary iteration best practices)iteration_workflow.md - Getting started: ,
installation_setup.md,glm_api_setup.mdworkflow_guide.md - Daily use: ,
quick_reference.md,script_parameters.mddictionary_guide.md - Advanced: ,
sql_queries.md,file_formats.md,architecture.mdbest_practices.md - Operations: ,
troubleshooting.mdteam_collaboration.md
脚本:
- - 初始化共享虚拟环境(运行一次,可选)
ensure_deps.py - - 增强版封装器(推荐交互式使用)
fix_transcript_enhanced.py - - 核心CLI工具(用于自动化)
fix_transcription.py - - 生成逐词差异对比HTML以审核修正内容
generate_word_diff.py - - 批量导入示例
examples/bulk_import.py
参考文档(按需加载):
- 关键文档: (数据库操作前必读)、
database_schema.md(字典迭代最佳实践)iteration_workflow.md - 入门指南: 、
installation_setup.md、glm_api_setup.mdworkflow_guide.md - 日常使用: 、
quick_reference.md、script_parameters.mddictionary_guide.md - 高级内容: 、
sql_queries.md、file_formats.md、architecture.mdbest_practices.md - 运维相关: 、
troubleshooting.mdteam_collaboration.md
Troubleshooting
故障排除
Verify setup health with . Common issues:
uv run scripts/fix_transcription.py --validate- Missing database → Run
--init - Missing API key → (obtain from https://open.bigmodel.cn/)
export GLM_API_KEY="<key>" - Permission errors → Check ownership
~/.transcript-fixer/
See for detailed error resolution and for API configuration.
references/troubleshooting.mdreferences/glm_api_setup.md使用验证设置是否正常。常见问题:
uv run scripts/fix_transcription.py --validate- 缺失数据库 → 运行
--init - 缺失API密钥 → (从https://open.bigmodel.cn/获取)
export GLM_API_KEY="<key>" - 权限错误 → 检查的所有权
~/.transcript-fixer/
详细错误解决请参阅,API配置请参阅。
references/troubleshooting.mdreferences/glm_api_setup.md