## New Skill: transcript-fixer v1.0.0 Correct speech-to-text (ASR/STT) transcription errors through dictionary-based rules and AI-powered corrections with automatic pattern learning. **Features:** - Two-stage correction pipeline (dictionary + AI) - Automatic pattern detection and learning - Domain-specific dictionaries (general, embodied_ai, finance, medical) - SQLite-based correction repository - Team collaboration with import/export - GLM API integration for AI corrections - Cost optimization through dictionary promotion **Use cases:** - Correcting meeting notes, lecture recordings, or interview transcripts - Fixing Chinese/English homophone errors and technical terminology - Building domain-specific correction dictionaries - Improving transcript accuracy through iterative learning **Documentation:** - Complete workflow guides in references/ - SQL query templates - Troubleshooting guide - Team collaboration patterns - API setup instructions **Marketplace updates:** - Updated marketplace to v1.8.0 - Added transcript-fixer plugin (category: productivity) - Updated README.md with skill description and use cases - Updated CLAUDE.md with skill listing and counts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
66 lines
1.5 KiB
Python
66 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Inline diff format generator
|
|
|
|
SINGLE RESPONSIBILITY: Generate inline diff with change markers
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import difflib
|
|
|
|
from .text_splitter import split_into_words
|
|
|
|
|
|
def generate_inline_diff(original: str, fixed: str) -> str:
|
|
"""
|
|
Generate inline diff marking deletions and additions
|
|
|
|
Format:
|
|
- Normal words: unchanged
|
|
- Deletions: [-word-]
|
|
- Additions: [+word+]
|
|
|
|
Args:
|
|
original: Original text
|
|
fixed: Fixed text
|
|
|
|
Returns:
|
|
Inline diff string with markers
|
|
"""
|
|
original_words = split_into_words(original)
|
|
fixed_words = split_into_words(fixed)
|
|
|
|
diff = difflib.ndiff(original_words, fixed_words)
|
|
|
|
result = []
|
|
result.append("=" * 80)
|
|
result.append("行内词语级别对比 (- 删除, + 添加, ? 修改标记)")
|
|
result.append("=" * 80)
|
|
result.append("")
|
|
|
|
current_line = []
|
|
for item in diff:
|
|
marker = item[0]
|
|
word = item[2:]
|
|
|
|
if marker == ' ':
|
|
current_line.append(word)
|
|
elif marker == '-':
|
|
current_line.append(f"[-{word}-]")
|
|
elif marker == '+':
|
|
current_line.append(f"[+{word}+]")
|
|
elif marker == '?':
|
|
# Skip change marker lines
|
|
continue
|
|
|
|
# Wrap at 80 characters
|
|
if len(''.join(current_line)) > 80:
|
|
result.append(''.join(current_line))
|
|
current_line = []
|
|
|
|
if current_line:
|
|
result.append(''.join(current_line))
|
|
|
|
return '\n'.join(result)
|