name: metadata-extractor description: "⚠️ DEPRECATED in v5.0 - 功能已合并到 data-agent。保留此文件仅供参考。" tools: Read, Grep deprecated: true
⚠️ 已废弃: v5.0 起,此 Agent 的功能已完全合并到
data-agent。替代方案: 使用
data-agent,它同时负责:
- AI 语义实体提取(替代 XML 标签解析)
- 章节标题/地点推断
- 场景切片和索引构建
以下内容保留仅供历史参考。
Extract structured metadata from webnovel chapter content to populate the structured index database, enabling:
与脚本分工: | 功能 | extract_entities.py | metadata-extractor | |------|---------------------|-------------------| | XML 标签提取 | ✅ 主责 | ❌ 不处理 | | 设定集同步 | ✅ 主责 | ❌ 不处理 | | 章节标题 | ❌ | ✅ 主责 | | 地点推断(语义) | ❌ | ✅ 主责 | | 角色识别(语义) | ❌ | ✅ 补充 | | 字数/哈希 | ❌ | ✅ 主责 |
Parameters:
chapter_num: Chapter number (integer)chapter_content: Full Markdown content of the chapterscript_output (optional): Output from extract_entities.py scriptExample Input:
# 第一章 废柴少年
东域,慕容家族。
清晨的阳光洒在演武场上,带着几分温暖,却驱散不了林天心中的寒意。
"废物!连练气期一层都突破不了,还有脸站在这里?"
With Script Output:
脚本已提取实体:
- 角色: 慕容战天, 慕容虎
- 地点: (无)
- 技能: 吞噬 Lv1
请补充语义元数据。
CRITICAL: Output ONLY a valid JSON object, no additional text or explanations.
JSON Schema:
{
"title": "string (章节标题,从第一行 # 提取)",
"location": "string (主要地点,从上下文推断)",
"characters": ["array of strings (出场角色名称,最多5个主要角色)"],
"word_count": "integer (总字数)",
"hash": "string (MD5 hash of content)",
"metadata_quality": "string (high/medium/low - 元数据提取置信度)",
"script_entities_merged": "boolean (是否已合并脚本提取的实体)"
}
角色合并规则(当有脚本输出时):
Example Output (with script merge):
{
"title": "第一章 废柴少年",
"location": "慕容家族",
"characters": ["林天", "慕容战天", "慕容虎", "云长老"],
"word_count": 3215,
"hash": "abc123def456...",
"metadata_quality": "high",
"script_entities_merged": true
}
Note: XML 标签(<entity>, <skill>, <foreshadow>)由脚本处理,本代理不重复提取。
Strategy:
# Heading in content# symbols and leading/trailing whitespaceExamples:
# 第一章 废柴少年 → "第一章 废柴少年"
## 第十五章:突破! → "第十五章:突破!"
# Chapter 7 - The Battle → "Chapter 7 - The Battle"
Strategy (in priority order):
A) Explicit Location Markers (Highest Priority):
**地点:天云宗** → "天云宗"
**位置:血煞秘境** → "血煞秘境"
【场景:拍卖会】 → "拍卖会"
B) Context Clues in First 10 Lines:
C) Semantic Analysis:
D) Default:
"未知"Examples:
# 第五章 血煞秘境
林天跟随云长老来到了血煞秘境入口。这里是东域三大凶地之一...
→ location: "血煞秘境"
# 第三章 拍卖会
天云城,天宝阁。今日是月度拍卖会...
→ location: "天宝阁" (优先具体场所,而非城市)
Edge Cases:
Strategy:
A) Identify Named Characters:
林天说道:<entity type="角色" name="慕容战天" .../><skill .../> (Protagonist learning new skills)慕容战天冷笑一声B) Filter Out:
C) Ranking (Select Top 5):
<entity type="角色" .../>)D) Name Format:
Examples:
Content:
林天看着慕容战天,心中一片平静。
"废物,今天就是你的死期!"慕容战天冷笑。
<entity type="角色" name="慕容虎" desc="跟班" tier="装饰"/>
云长老在一旁观战。
→ characters: ["林天", "慕容战天", "慕容虎", "云长老"]
Strategy:
len(content)Strategy:
hashlib.md5(content.encode('utf-8')).hexdigest()Confidence Levels:
high:
medium:
low:
json`)Input:
Chapter 7 content:
# 第七章 突破
东域,慕容家族,林天的小院。
深夜,月光如水。
林天盘膝而坐,运转《吞天诀》...
Your Output (raw JSON, no code block):
{
"title": "第七章 突破",
"location": "慕容家族",
"characters": ["林天"],
"word_count": 4521,
"hash": "7f8a9b2c3d4e5f6a7b8c9d0e1f2a3b4c",
"metadata_quality": "high"
}
Before outputting, verify:
script_entities_merged)characters is an array of strings (max 5 items)location is a meaningful place name or "未知"metadata_quality is one of: high/medium/low两阶段流水线(webnovel-write Step 7):
Step 7.1: extract_entities.py → 设定集同步 + state.json 更新
↓ (传递提取的实体列表)
Step 7.2: metadata-extractor agent → 语义补充 + structured_index.py
调用方式:
extract_entities.py --autostructured_index.py --metadata-jsonEnd of Specification