Compare commits
12 Commits
v1.5
..
3c0a67b67a
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c0a67b67a | |||
| 8d5beadcc7 | |||
| 36e48f90f7 | |||
| 4fb9635d15 | |||
| e1db39e36f | |||
| 996c25af3f | |||
| d17b55f6c5 | |||
| e61a299d84 | |||
| 0ac50d17ec | |||
| 22fd634498 | |||
| cb540eb113 | |||
| 94a51abed8 |
@@ -1,60 +0,0 @@
|
|||||||
# Semantic Segmentation for SRT Processing
|
|
||||||
|
|
||||||
**Status:** Backlog
|
|
||||||
**Priority:** Medium
|
|
||||||
**Source:** User feedback during v1.5 testing
|
|
||||||
|
|
||||||
## Problem
|
|
||||||
|
|
||||||
Current `SemanticSegmenter` uses simple heuristic rules:
|
|
||||||
- Time gap > 3 seconds
|
|
||||||
- Paragraph length > 500 characters
|
|
||||||
|
|
||||||
This approach cannot identify **semantic topic transitions**.
|
|
||||||
|
|
||||||
### Example Case
|
|
||||||
|
|
||||||
Video: BV1MiPSz2ErY (科学透镜 - 5 topics in one video)
|
|
||||||
1. 银河系中心的超大黑洞人马座A*其实不是黑洞
|
|
||||||
2. 银河系和仙女座星系等构成的本星系群陷入巨大物质薄片
|
|
||||||
3. 科学家为世界上97%的建筑生成3D模型
|
|
||||||
4. 雷暴的形成
|
|
||||||
5. 闪电的形成
|
|
||||||
|
|
||||||
Current segmentation mixes these topics together.
|
|
||||||
|
|
||||||
## Potential Solutions
|
|
||||||
|
|
||||||
### Option 1: Transition Keyword Detection (Simple)
|
|
||||||
- Detect common transition phrases: "接下来", "另外", "第二个", etc.
|
|
||||||
- **Pros:** Fast, no API calls
|
|
||||||
- **Cons:** Low accuracy, many videos lack explicit transitions
|
|
||||||
|
|
||||||
### Option 2: LLM-Based Segmentation (Accurate)
|
|
||||||
- Ask LLM to analyze entire subtitle and identify topic boundaries
|
|
||||||
- **Pros:** Highest accuracy, understands semantics
|
|
||||||
- **Cons:** Extra API cost, token limits for long videos
|
|
||||||
|
|
||||||
### Option 3: Two-Stage Approach (Balanced)
|
|
||||||
- Stage 1: Simple rule-based segmentation (current)
|
|
||||||
- Stage 2: LLM checks paragraph beginnings for new topics
|
|
||||||
- **Pros:** Most cases use simple rules, LLM only for key decisions
|
|
||||||
- **Cons:** More complex implementation
|
|
||||||
|
|
||||||
### Option 4: Embedding-Based Similarity
|
|
||||||
- Calculate semantic similarity between adjacent paragraphs
|
|
||||||
- Low similarity = topic boundary
|
|
||||||
- **Pros:** No LLM API calls, runs locally
|
|
||||||
- **Cons:** Requires embedding model, implementation complexity
|
|
||||||
|
|
||||||
## Recommendation
|
|
||||||
|
|
||||||
**Phase 1 (Quick Win):** Transition keyword detection + improve prompt
|
|
||||||
|
|
||||||
**Phase 2 (Full Solution):** Two-stage approach with optional LLM semantic segmentation
|
|
||||||
|
|
||||||
## Success Criteria
|
|
||||||
|
|
||||||
1. Topics are separated correctly
|
|
||||||
2. Each paragraph covers a single coherent topic
|
|
||||||
3. No false splits within a topic
|
|
||||||
@@ -26,11 +26,7 @@ class AIClientProtocol(Protocol):
|
|||||||
|
|
||||||
# 纠错 Prompt 模板
|
# 纠错 Prompt 模板
|
||||||
CORRECTION_PROMPT = """你是一个文本校对专家。以下是语音识别生成的字幕,可能包含识别错误。
|
CORRECTION_PROMPT = """你是一个文本校对专家。以下是语音识别生成的字幕,可能包含识别错误。
|
||||||
|
请只纠正明显的错误(如同音字、漏字、错字),不要改变原意和风格。
|
||||||
请执行以下任务:
|
|
||||||
1. 纠正明显的错误(如同音字、漏字、错字)
|
|
||||||
2. 添加适当的标点符号(逗号、句号、顿号等)
|
|
||||||
3. 不要改变原意和风格
|
|
||||||
|
|
||||||
原文:
|
原文:
|
||||||
{text}
|
{text}
|
||||||
|
|||||||
Reference in New Issue
Block a user