{"id":"24994bca-b0f0-4e6b-b4be-6a6af6ea0357","entityType":"agent","slug":"clawhub-mengbin92-novel-character-graph","name":"Novel Character Graph","canonicalUrl":"https://www.xpersona.co/agent/clawhub-mengbin92-novel-character-graph","canonicalPath":"/agent/clawhub-mengbin92-novel-character-graph","generatedAt":"2026-10-13T18:57:12.920Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-12T02:40:07.610Z","emptyReason":null},"description":"Professional long-form novel analysis and character relationship mapping + theme song generation. Automatically handles GBK/UTF-8 encoding, multi-GB file chu... Skill: Novel Character Graph Owner: mengbin92 Summary: Professional long-form novel analysis and character relationship mapping + theme song generation. Automatically handles GBK/UTF-8 encoding, multi-GB file chu... Tags: character-relationship:1.0.0, latest:1.0.2, novel:1.0.0, visualization:1.0.0 Version history: v1.0.2 | 2026-04-26T13:54:42.076Z | auto - Initial release of version 1.0.2. - Added _meta.json file. v1","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 953 downloads reported by the source. Last updated 10/12/2026.","installCommand":"clawhub skill install s17335d97qcgwk12m5ge52yg8s83g8z5:novel-character-graph","sourceUrl":"https://clawhub.ai/mengbin92/novel-character-graph","homepage":"https://clawhub.ai/mengbin92/skills/novel-character-graph","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/mengbin92/novel-character-graph","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/mengbin92/skills/novel-character-graph","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":60,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Professional long-form novel analysis and character relationship mapping + theme song generation. Automatically handles GBK/UTF-8 encoding, multi-GB file chu..."},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-12T02:40:07.610Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-12T02:40:07.610Z","emptyReason":null},"stars":null,"forks":null,"downloads":953,"likes":null,"task":null,"library":null,"packageName":null,"latestVersion":"1.0.2","tractionLabel":"953 downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-12T02:40:07.596Z","emptyReason":null},"lastUpdatedAt":"2026-10-12T02:40:07.610Z","lastCrawledAt":"2026-10-12T02:40:07.596Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-13T02:40:07.596Z","lastVerifiedAt":null,"highlights":[{"version":"1.0.2","createdAt":"2026-04-26T13:54:42.076Z","changelog":"- Initial release of version 1.0.2. - Added `_meta.json` file.","fileCount":8,"zipByteSize":16494},{"version":"1.0.1","createdAt":"2026-04-23T06:33:46.962Z","changelog":"**Summary: Added professional large-scale novel analysis, multi-format support, and theme song generation.** - New: Supports TXT, EPUB, PDF, DOCX, and MOBI formats with automatic encoding detection and conversion. - New: Splits and processes large files/chaptered novels incrementally, suitable for multi-million word works. - New: Outputs standardized character system, worldviews, item/skill listings, multi-category relationship graphs, and full markdown reports. - New: Generates interactive HTML relationship maps with multi-tab structure (relationships, character cards, worldview, manga setup). - New: Integrated Suno AI-powered theme/OST/song generation for novels, with customizable style templates and lyrics structure. - Added: Utility scripts for chapter splitting, character extraction, and HTML graph generation. - Improved: More robust, modular, and professional workflow designed for long-form, complex novel projects.","fileCount":7,"zipByteSize":15200},{"version":"1.0.0","createdAt":"2026-04-17T03:39:20.638Z","changelog":"Initial version","fileCount":6,"zipByteSize":12156}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s17335d97qcgwk12m5ge52yg8s83g8z5:novel-character-graph","setupComplexity":"low","setupSteps":["Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-mengbin92-novel-character-graph/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-mengbin92-novel-character-graph/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-mengbin92-novel-character-graph/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-mengbin92-novel-character-graph/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-mengbin92-novel-character-graph/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-mengbin92-novel-character-graph/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-13T18:57:12.919Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-mengbin92-novel-character-graph/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-mengbin92-novel-character-graph/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-mengbin92-novel-character-graph/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-mengbin92-novel-character-graph/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-12T02:40:07.610Z","emptyReason":null},"readme":"Skill: Novel Character Graph\n\nOwner: mengbin92\n\nSummary: Professional long-form novel analysis and character relationship mapping + theme song generation. Automatically handles GBK/UTF-8 encoding, multi-GB file chu...\n\nTags: character-relationship:1.0.0, latest:1.0.2, novel:1.0.0, visualization:1.0.0\n\nVersion history:\n\nv1.0.2 | 2026-04-26T13:54:42.076Z | auto\n\n- Initial release of version 1.0.2.\n- Added `_meta.json` file.\n\nv1.0.1 | 2026-04-23T06:33:46.962Z | user\n\n**Summary: Added professional large-scale novel analysis, multi-format support, and theme song generation.**\n\n- New: Supports TXT, EPUB, PDF, DOCX, and MOBI formats with automatic encoding detection and conversion.\n- New: Splits and processes large files/chaptered novels incrementally, suitable for multi-million word works.\n- New: Outputs standardized character system, worldviews, item/skill listings, multi-category relationship graphs, and full markdown reports.\n- New: Generates interactive HTML relationship maps with multi-tab structure (relationships, character cards, worldview, manga setup).\n- New: Integrated Suno AI-powered theme/OST/song generation for novels, with customizable style templates and lyrics structure.\n- Added: Utility scripts for chapter splitting, character extraction, and HTML graph generation.\n- Improved: More robust, modular, and professional workflow designed for long-form, complex novel projects.\n\nv1.0.0 | 2026-04-17T03:39:20.638Z | user\n\nInitial version\n\nArchive index:\n\nArchive v1.0.2: 8 files, 16494 bytes\n\nFiles: _meta.json (140b), assets/graph_template.html (4201b), references/format_handbook.md (1451b), scripts/chapter_split.py (1398b), scripts/character_extract.py (2250b), scripts/generate_html.py (3486b), skill-card.md (2386b), SKILL.md (15320b)\n\nFile v1.0.2:SKILL.md\n\n---\nname: novel-character-graph\ndescription: \"Professional long-form novel analysis and character relationship mapping + theme song generation. Automatically handles GBK/UTF-8 encoding, multi-GB file chunking, chapter-by-chapter incremental parsing, supports TXT/EPUB/PDF/DOCX novel formats. Outputs complete character system, relationship maps, worldviews, weapon/item systems, interactive visualization HTML, and AI-generated theme songs (Suno). Use when users ask for: novel analysis, character mapping, relationship graphs, worldview architecture, story timeline organization, manga/comic adaptation settings, novel theme song, ending song, OST.\"\ntags: [novel, analysis, character, relationship, graph, xianxia, wuxia, fantasy, song, music]\ntriggers:\n  - 小说分析\n  - 人物图谱\n  - 人物关系\n  - 关系图谱\n  - 世界观\n  - 小说人物\n  - 角色设定\n  - 主题曲\n  - 片头曲\n  - 片尾曲\n  - OST\n  - 小说配乐\nrequired_commands:\n  - iconv\n  - ebook-convert\n  - pdftotext\n  - pandoc\nusage_hint: >\n  当用户提到「小说分析」「人物图谱」「关系图」「世界观」「角色设定」时使用本skill。\n  当用户提到「主题曲」「片头曲」「片尾曲」「OST」「配乐」时也使用本skill（可独立使用，\n  不需要先做完整人物分析，直接基于用户描述的小说类型/情绪生成即可）。\n---\n\n# 小说人物图谱专业分析Skill + 主题曲生成\n\n## 核心能力\n\n本Skill专业处理百万字级长篇小说深度分析，解决大文件无法一次性解析的问题，并能为小说生成专属主题曲。\n\n---\n\n## 第一步：文件预处理流程\n\n### 1.1 文件格式检测与编码修复\n\n```bash\n# 1. 检测文件基本信息\nfile -i <小说文件>\nwc -l <小说文件>\nls -lh <小说文件>\n\n# 2. 编码自动修复（中文小说90%为GBK编码）\ncat <小说文件> | iconv -f GBK -t UTF-8 2>/dev/null > decoded.tmp && mv decoded.tmp <小说文件>_utf8.txt\n\n# 3. 编码失败备选方案\niconv -f GB18030 -t UTF-8 <小说文件> 2>/dev/null\niconv -f BIG5 -t UTF-8 <小说文件> 2>/dev/null\n```\n\n### 1.2 支持的主流小说格式\n\n| 格式 | 处理方法 | 依赖命令 |\n|------|---------|---------|\n| ✅ `.txt` | 直接分段读取 | - |\n| ✅ `.epub` | `ebook-convert file.epub file.txt` | `calibre-bin` |\n| ✅ `.pdf` | `pdftotext -layout file.pdf output.txt` | `poppler-utils` |\n| ✅ `.docx` | `pandoc -s file.docx -o output.txt` | `pandoc` |\n| ✅ `.mobi` | `ebook-convert file.mobi file.txt` | `calibre-bin` |\n\n> 安装依赖：`sudo apt install calibre-bin poppler-utils pandoc`\n\n---\n\n## 第二步：大文件智能分段解析\n\n### 2.1 分段策略（>10万行强制分段）\n\n```\n文件大小 < 500KB  → 一次性读取\n500KB - 2MB → 分2-4段\n2MB - 10MB → 每500行一段增量解析\n> 10MB → 每1000行一段增量解析\n```\n\n### 2.2 分段读取Shell模板\n\n```bash\n# 分段读取命令模板\ncat <小说文件> | head -n +500          # 第1段\ncat <小说文件> | tail -n +501 | head -n 500  # 第2段\ncat <小说文件> | tail -n +1001 | head -n 500 # 第3段\n# ... 以此类推\n```\n\n### 2.3 每段解析核心提取项\n\n每段必须提取并增量更新：\n- ✅ 新出场人物全名 + 别名 + 外号\n- ✅ 人物关系变化（敌对/盟友/情侣/师徒/血缘）\n- ✅ 关键剧情节点 + 时间线推进\n- ✅ 武功/功法/神器/丹药系统更新\n- ✅ 势力阵营/宗门/国家变化\n- ✅ 重要伏笔 + 世界观补全\n\n---\n\n## 第三步：人物体系标准化建模\n\n### 3.1 人物层级分类体系\n\n| 层级 | 定义标准 | 详细程度 |\n|------|---------|---------|\n| S级核心人物 | 主角团 + 最终BOSS + 关键导师 | 深度解析：性格/成长线/经典场景/漫画设定 |\n| A级重要人物 | 主要反派 + 主要盟友 + 主要女主 | 完整人物卡 |\n| B级次要人物 | 重要配角 + 各门派掌门 | 基础信息 + 立场 |\n| C级NPC | 路人甲 + 一次性炮灰 | 只计数不展开 |\n\n### 3.2 标准人物卡模板\n\n```markdown\n### 🎭 人物名称\n- **身份**：详细身份定位\n- **修为/境界**：\n- **性格特质**：3-5个核心关键词\n- **核心能力/功法**：\n- **人物关系网**：\n  - ❤️ 恋人：xxx\n  - 👨‍🏫 师父：xxx\n  - ⚔️ 死敌：xxx\n  - 👬 兄弟：xxx\n- **经典分镜/漫画设定**：\n```\n\n---\n\n## 第四步：关系图谱构建规范\n\n### 4.1 四大核心关系类型\n\n使用标准Emoji统一标记：\n| 关系类型 | Emoji标记 |\n|---------|-----------|\n| 爱情/道侣 | ❤️ 💕 |\n| 师徒/传承 | 👨‍🏫 👩‍🏫 |\n| 兄弟/战友 | 👬 🤝 |\n| 血缘/家族 | 👨‍👩‍👧 |\n| 敌对/死仇 | ⚔️ 💀 |\n| 上下级/从属 | 👑 🛡️ |\n\n### 4.2 ASCII关系总图规范\n\n```\n                    【核心主角】⭐\n           ┌───────────┼───────────┐\n        【女主1】💕  【兄弟】👬  【师父】👨‍🏫\n           │           │           │\n        家族线      战队线      功法线\n```\n\n---\n\n## 第五步：输出交付标准\n\n### 5.1 必须交付的三个文件\n\n| 交付物 | 文件名 | 内容 |\n|-------|--------|------|\n| 1 | `《书名》_人物完整谱系.md` | 完整人物体系 + 势力架构 + 功法系统 + 时间线 |\n| 2 | `《书名》_核心人物关系.md` | S级+A级人物深度解析 + 漫画分镜设定 |\n| 3 | `index.html` | TailwindCSS + SVG交互式动态图谱网页 |\n\n### 5.2 交互式网页标准组件\n\nHTML页面必须包含4个标签页：\n1. 🕸️ **关系图谱页** - SVG动态连线图\n2. 👤 **人物介绍页** - 毛玻璃人物卡片\n3. 🌍 **势力格局页** - 阵营分布 + 战力对比\n4. 🎨 **漫画设定页** - 每人画风+色彩+经典分镜\n\n---\n\n## 第六步：质量检查清单\n\n交付前必须验证：\n\n✅ **编码正确** - 无乱码、无问号、无GBK残留\n✅ **人物数量** - 长篇小说≥100人，中篇≥50人，短篇≥20人\n✅ **无遗漏** - 女主/反派/导师/兄弟四大类完整\n✅ **关系清晰** - 爱情/敌对/师徒/阵营四类关系无歧义\n✅ **世界观** - 功法/境界/神器/丹药系统完整\n\n---\n\n## 第七步：主题曲生成（可选增值服务）\n\n> 当用户要求生成主题曲、片头曲、片尾曲、OST、配乐时执行本节\n> **注意**：主题曲功能可独立使用，不需要先做完整人物分析。\n> 用户可以直接描述小说类型和想要的风格，跳过第一步到第六步直接到本节。\n\n### 7.1 推荐主题供用户挑选\n\n分析小说后，根据**类型/题材/情绪氛围**，从以下预设主题中推荐3-5个：\n\n| 主题风格 | 适用场景 | 情绪关键词 |\n|---------|---------|-----------|\n| 🔥 **热血燃战** | 主角爆发、决战、逆袭 | 燃、热血、激昂、不屈 |\n| 🌙 **古风柔情** | 爱情线、离别、思念 | 婉约、忧伤、唯美、深情 |\n| ⚔️ **江湖侠气** | 武侠小说、门派争斗 | 豪迈、洒脱、义气、快意 |\n| 🌌 **史诗宏大** | 世界观展示、神魔大战 | 庄严、壮阔、神秘、命运 |\n| ❄️ **冰冽虐心** | 悲剧结局、失去、死亡 | 压抑、悲怆、孤独、破碎 |\n| ☀️ **希望曙光** | 主角成长、胜利、重生 | 希望、温暖、崛起、救赎 |\n| 🔮 **宿命轮回** | 穿越、系统、转生 | 轮回、命运、混沌、超脱 |\n| 🌸 **青春校园** | 现代言情、校园恋爱 | 清新、甜蜜、悸动、纯真 |\n\n**用户也可以自己指定主题风格**，直接进入7.2节。\n\n### 7.2 Suno AI主题曲创作\n\n根据小说内容构建Suno提示词：\n\n#### Style字段公式\n\n```\nGenre + Mood + Era + Instruments + Vocal Style + Production + Dynamics\n```\n\n#### 小说主题曲Style参考模板\n\n**🔥 热血燃战型**\n```\nEpic xianxia battle anthem, intense heroic atmosphere, ancient Chinese fantasy,\ndrums and erhu lead, male vocalist with powerful belting, orchestral percussion,\nminor key with triumphant modulations, building from ominous intro to explosive chorus,\n90BPM D minor\n```\n\n**🌙 古风柔情型**\n```\nAncient Chinese romantic ballad, melancholic and ethereal, guqin and bamboo flute,\nfemale vocalist with soulful nasally tone, sparse arrangement with gradual orchestral layers,\n情感爆发点在副歌, Bb major 65BPM\n```\n\n**⚔️ 江湖侠气型**\n```\nWuxia martial arts world soundtrack, bold and free-spirited, traditional Chinese instruments\npipa and dizi, male vocalist with raw gritty tone, rhythmic drums with folk elements,\noutro fades to peaceful resolution, G minor 85BPM\n```\n\n**🌌 史诗宏大型**\n```\nEpic dark fantasy orchestral, divine and mysterious atmosphere, full symphonic orchestra\nwith choir, operatic male vocals with reverb, Gregorian chant elements,\n命运感强烈, E minor 120BPM\n```\n\n#### Lyrics结构标签（写在歌词中）\n\n```\n[Intro] [Verse] [Pre-Chorus] [Chorus]\n[Post-Chorus] [Bridge] [Interlude]\n[Instrumental] [Outro]\n```\n\n#### 动态标签（描述演唱情绪）\n\n| 标签 | 含义 |\n|------|------|\n| `[Powerful]` | 爆发力强 |\n| `[Whispered]` | 低语诉说 |\n| `[Soulful]` | 深情款款 |\n| `[Gritty]` | 粗犷沙哑 |\n| `[Falsetto]` | 假音飘渺 |\n| `[Building Energy]` | 渐强递进 |\n| `[Emotional Climax]` | 情感高潮 |\n\n### 7.3 主题曲与视频合成\n\n生成音频后，用ffmpeg合并视频：\n\n```bash\n# 方式一：6秒精华版（视频片段 + 歌曲开头）\nffmpeg -y -i <视频文件> -i <音频文件> \\\n  -vf \"fade=t=in:st=0:d=0.5,fade=t=out:st=5.5:d=0.5\" \\\n  -c:v libx264 -c:a aac -shortest \\\n  <输出文件>\n\n# 方式二：循环版（视频循环 + 歌曲完整版）\nffmpeg -y -stream_loop 9 -i <视频文件> -i <音频文件> \\\n  -vf \"fade=t=in:st=0:d=1,fade=t=out:st=54:d=2\" \\\n  -c:v libx264 -c:a aac -t <时长秒数> \\\n  <输出文件>\n```\n\n---\n\n## 第八步：进阶脚本（可选）\n\n> 以下脚本位于 `scripts/` 目录，执行前先验证环境，无需用户批准即可安装依赖。\n\n`scripts/chapter_split.py` - 按章节智能分割大文件\n`scripts/character_extract.py` - NLP辅助提取人名（中文分词）\n`scripts/generate_html.py` - 自动生成交互式图谱页面\n\n### 8.1 chapter_split.py（章节分割）\n\n```python\n#!/usr/bin/env python3\n\"\"\"智能章节分割脚本 - 按章节将大文件分成多个小文件\"\"\"\n\nimport re\nimport os\nimport sys\n\ndef split_by_chapters(file_path, output_dir=None):\n    \"\"\"检测章节标题并分割文件\"\"\"\n    with open(file_path, 'r', encoding='utf-8') as f:\n        content = f.read()\n\n    # 常见章节标题正则\n    chapter_pattern = re.compile(\n        r'^第[一二三四五六七八九十百千\\d]+[章节卷部篇]\\s*[：:]\\s*.+$',\n        re.MULTILINE\n    )\n\n    chapters = chapter_pattern.split(content)\n    if len(chapters) <= 1:\n        # 备选：简单按\"第X章\"分割\n        chapter_pattern = re.compile(r'第[一二三四五六七八九十百千\\d]+章')\n        chapters = chapter_pattern.split(content)\n\n    base_name = os.path.splitext(os.path.basename(file_path))[0]\n    output_dir = output_dir or os.path.dirname(file_path)\n\n    for i, chapter_content in enumerate(chapters):\n        if chapter_content.strip():\n            output_path = os.path.join(output_dir, f\"{base_name}_第{i+1}章.txt\")\n            with open(output_path, 'w', encoding='utf-8') as f:\n                f.write(chapter_content.strip())\n            print(f\"OK: {output_path}\")\n\nif __name__ == \"__main__\":\n    if len(sys.argv) < 2:\n        print(\"Usage: python chapter_split.py <novel.txt>\")\n        sys.exit(1)\n    split_by_chapters(sys.argv[1])\n```\n\n### 8.2 character_extract.py（人名提取）\n\n```python\n#!/usr/bin/env python3\n\"\"\"基于结巴分词的中文人名提取辅助工具\"\"\"\n\nimport re\nimport os\nimport sys\n\ndef extract_names(text, top_n=100):\n    \"\"\"提取文本中的中国人名（简单基于姓氏词典）\"\"\"\n    # 常见姓氏\n    surnames = r'[赵钱孙李周吴郑王冯陈褚卫蒋沈韩杨朱秦尤许何吕施张孔曹严华金魏陶姜戚谢邹喻柏水窦章云苏潘葛奚范彭郎鲁韦昌马苗凤花方俞任袁柳酆鲍史唐费廉岑薛雷贺倪汤滕殷罗毕郝邬安常乐于时傅皮卞齐康伍余元卜顾孟平黄穆萧尹姚邵堪汪祁毛禹狄米贝明臧计伏成戴谈宋茅庞熊纪舒屈项祝董梁杜阮蓝闵席季麻强贾路娄危江童颜郭梅盛林刁钟徐邱骆高夏蔡田樊胡凌霍虞万支柯咎管卢莫经房裘缪干解应宗丁宣贲邓郁单杭洪包诸左右崔吉钮龚程嵇邢滑裴陆荣翁荀羊于惠甄曲面加羊舌微巢关蒯相查后荆红游竺权逯盖益桓公万俟司马上官欧阳夏侯诸葛闻人东方赫连皇甫尉迟公羊澹台公冶宗政濮阳淳于单于太叔申屠公孙仲孙轩辕令狐钟离宇文长孙慕容鲜于闾丘司徒司空亓官司寇仉督子车颛孙端木巫马公西漆雕乐正壤驷公良拓跋夹谷宰父谷利段干百里东郭南门呼延归海羊舌微生岳帅缑亢况后有琴梁丘左丘东门西门商牟佘佴伯赏南宫墨哈谯笪年爱阳佟]'\n\n    # 简单的人名匹配（姓氏+1-2个汉字）\n    pattern = re.compile(rf'{surnames}[\\u4e00-\\u9fff]{{1,3}}')\n    names = pattern.findall(text)\n\n    # 去重并统计频率\n    name_freq = {}\n    for name in names:\n        name_freq[name] = name_freq.get(name, 0) + 1\n\n    sorted_names = sorted(name_freq.items(), key=lambda x: x[1], reverse=True)\n    return sorted_names[:top_n]\n\nif __name__ == \"__main__\":\n    if len(sys.argv) < 2:\n        print(\"Usage: python character_extract.py <novel.txt> [top_n]\")\n        sys.exit(1)\n\n    file_path = sys.argv[1]\n    top_n = int(sys.argv[2]) if len(sys.argv) > 2 else 100\n\n    with open(file_path, 'r', encoding='utf-8') as f:\n        text = f.read()\n\n    names = extract_names(text, top_n)\n    print(f\"共提取到 {len(names)} 个人名：\")\n    for name, freq in names:\n        print(f\"  {name}: {freq}次\")\n```\n\n### 8.3 generate_html.py（生成交互图谱）\n\n```python\n#!/usr/bin/env python3\n\"\"\"自动生成交互式人物关系图谱HTML\"\"\"\n\nimport os\nimport sys\n\nTEMPLATE_PATH = os.path.join(os.path.dirname(__file__), '../assets/graph_template.html')\n\ndef generate_html(title, subtitle, characters, relationships, output_path='index.html'):\n    \"\"\"生成HTML图谱\"\"\"\n\n    with open(TEMPLATE_PATH, 'r', encoding='utf-8') as f:\n        template = f.read()\n\n    # 填充标题\n    template = template.replace('{{TITLE}}', title)\n    template = template.replace('{{SUBTITLE}}', subtitle)\n\n    # 生成人物卡片HTML\n    cards_html = ''\n    for char in characters:\n        cards_html += f'''\n        <div class=\"character-card bg-gray-800/50 rounded-2xl p-6 border border-gray-700/50\">\n            <h3 class=\"text-xl font-bold text-orange-400 mb-2\">{char['name']}</h3>\n            <p class=\"text-gray-300 text-sm\">{char.get('identity', '')}</p>\n            <p class=\"text-gray-400 text-xs mt-2\">修为：{char.get('realm', '未知')}</p>\n        </div>\n        '''\n\n    # 替换占位符\n    template = template.replace('<!-- CHARACTER_CARDS -->', cards_html)\n\n    with open(output_path, 'w', encoding='utf-8') as f:\n        f.write(template)\n\n    print(f\"OK: {output_path}\")\n\nif __name__ == \"__main__\":\n    print(\"Usage: from generate_html import generate_html\")\n    print(\"       generate_html('小说名', '副标题', characters_list, relationships_list)\")\n\nFile v1.0.2:_meta.json\n\n{\n  \"ownerId\": \"kn73pfccc8e95j989m8js0x9zx82p86q\",\n  \"slug\": \"novel-character-graph\",\n  \"version\": \"1.0.2\",\n  \"publishedAt\": 1777211682076\n}\n\nFile v1.0.2:references/format_handbook.md\n\n# 小说格式处理手册\n\n## 编码问题终极解决方案\n\n### 中文小说编码问题诊断\n\n99%的中文TXT小说编码问题：\n- 老小说：GBK / GB18030 编码（起点/纵横等老站）\n- 新小说：UTF-8 编码\n- 台湾小说：BIG5 编码\n\n### 批量编码转换脚本\n\n```bash\n# 批量转换GBK→UTF-8\nfor f in *.txt; do\n    iconv -f GBK -t UTF-8 \"$f\" -o \"${f%.txt}_utf8.txt\" 2>/dev/null && mv \"${f%.txt}_utf8.txt\" \"$f\" && echo \"OK: $f\" || echo \"FAIL: $f\"\ndone\n```\n\n---\n\n## 各格式转换工具安装\n\n### EPUB/MOBI 处理\n\n```bash\n# Debian/Ubuntu\nsudo apt install calibre-bin poppler-utils pandoc\n\n# 转换命令\nebook-convert novel.epub novel.txt\nebook-convert novel.mobi novel.txt\n```\n\n### PDF 处理\n\n```bash\n# 最佳文本提取工具\npdftotext -layout novel.pdf output.txt\npdftotext -f 10 -l 100 novel.pdf output.txt  # 指定页码范围\n```\n\n### DOCX 处理\n\n```bash\npandoc -s novel.docx -o output.txt\n```\n\n---\n\n## 大文件分段Shell脚本\n\n```bash\n#!/bin/bash\n# split_novel.sh - 智能分段脚本\n\nFILE=$1\nLINES_PER_CHUNK=500\nTOTAL_LINES=$(wc -l < \"$FILE\")\nCHUNKS=$(( (TOTAL_LINES + LINES_PER_CHUNK - 1) / LINES_PER_CHUNK ))\n\necho \"Total: $TOTAL_LINES lines, split into $CHUNKS chunks\"\n\nfor i in $(seq 1 $CHUNKS); do\n    START=$(( (i-1) * LINES_PER_CHUNK + 1 ))\n    echo \"=== Chunk $i / $CHUNKS (lines $START - $((START + LINES_PER_CHUNK - 1))) ===\"\n    cat \"$FILE\" | tail -n +$START | head -n $LINES_PER_CHUNK\ndone\n```\n\nFile v1.0.2:skill-card.md\n\n## Description:\n\nAnalyzes long-form novels, maps characters and relationships, prepares worldview and timeline outputs, builds interactive HTML relationship graphs, and drafts theme-song prompts.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[mengbin92](https://clawhub.ai/user/mengbin92)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers, writers, and content teams use this skill to analyze novels in TXT, EPUB, PDF, DOCX, or MOBI form and produce character systems, relationship maps, timelines, worldview notes, interactive graph reports, and song-generation prompts.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The security evidence reports that the skill explicitly allows dependency installation without user approval.\n\nMitigation: Require explicit user approval before any apt, sudo, pip, media conversion, or package-installation command is run.\n\nRisk: Generated HTML reports can expose users to unsafe content if untrusted novel data is inserted without escaping or if remote scripts are loaded.\n\nMitigation: Open generated reports only after reviewing the template and escaping behavior, and avoid remote script loading for untrusted inputs.\n\nRisk: Preprocessing and conversion commands can overwrite or transform source novel files.\n\nMitigation: Keep backups of source novels and write converted files, split chapters, Markdown reports, and HTML outputs to a separate working directory.\n\n## Reference(s):\n\n- [Format Handbook](references/format_handbook.md)\n- [ClawHub Skill Page](https://clawhub.ai/mengbin92/skills/novel-character-graph)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance, files]\n\n**Output Format:** [Markdown, shell commands, Python-generated HTML, and Suno-style song prompt text]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Can create novel analysis Markdown files and an interactive HTML relationship graph; users should review commands and generated HTML before use.]\n\n## Skill Version(s):\n\n1.0.2 (source: server release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nArchive v1.0.1: 7 files, 15200 bytes\n\nFiles: assets/graph_template.html (4201b), references/format_handbook.md (1451b), scripts/chapter_split.py (1398b), scripts/character_extract.py (2250b), scripts/generate_html.py (3486b), SKILL.md (15320b), _meta.json (140b)\n\nFile v1.0.1:SKILL.md\n\n---\nname: novel-character-graph\ndescription: \"Professional long-form novel analysis and character relationship mapping + theme song generation. Automatically handles GBK/UTF-8 encoding, multi-GB file chunking, chapter-by-chapter incremental parsing, supports TXT/EPUB/PDF/DOCX novel formats. Outputs complete character system, relationship maps, worldviews, weapon/item systems, interactive visualization HTML, and AI-generated theme songs (Suno). Use when users ask for: novel analysis, character mapping, relationship graphs, worldview architecture, story timeline organization, manga/comic adaptation settings, novel theme song, ending song, OST.\"\ntags: [novel, analysis, character, relationship, graph, xianxia, wuxia, fantasy, song, music]\ntriggers:\n  - 小说分析\n  - 人物图谱\n  - 人物关系\n  - 关系图谱\n  - 世界观\n  - 小说人物\n  - 角色设定\n  - 主题曲\n  - 片头曲\n  - 片尾曲\n  - OST\n  - 小说配乐\nrequired_commands:\n  - iconv\n  - ebook-convert\n  - pdftotext\n  - pandoc\nusage_hint: >\n  当用户提到「小说分析」「人物图谱」「关系图」「世界观」「角色设定」时使用本skill。\n  当用户提到「主题曲」「片头曲」「片尾曲」「OST」「配乐」时也使用本skill（可独立使用，\n  不需要先做完整人物分析，直接基于用户描述的小说类型/情绪生成即可）。\n---\n\n# 小说人物图谱专业分析Skill + 主题曲生成\n\n## 核心能力\n\n本Skill专业处理百万字级长篇小说深度分析，解决大文件无法一次性解析的问题，并能为小说生成专属主题曲。\n\n---\n\n## 第一步：文件预处理流程\n\n### 1.1 文件格式检测与编码修复\n\n```bash\n# 1. 检测文件基本信息\nfile -i <小说文件>\nwc -l <小说文件>\nls -lh <小说文件>\n\n# 2. 编码自动修复（中文小说90%为GBK编码）\ncat <小说文件> | iconv -f GBK -t UTF-8 2>/dev/null > decoded.tmp && mv decoded.tmp <小说文件>_utf8.txt\n\n# 3. 编码失败备选方案\niconv -f GB18030 -t UTF-8 <小说文件> 2>/dev/null\niconv -f BIG5 -t UTF-8 <小说文件> 2>/dev/null\n```\n\n### 1.2 支持的主流小说格式\n\n| 格式 | 处理方法 | 依赖命令 |\n|------|---------|---------|\n| ✅ `.txt` | 直接分段读取 | - |\n| ✅ `.epub` | `ebook-convert file.epub file.txt` | `calibre-bin` |\n| ✅ `.pdf` | `pdftotext -layout file.pdf output.txt` | `poppler-utils` |\n| ✅ `.docx` | `pandoc -s file.docx -o output.txt` | `pandoc` |\n| ✅ `.mobi` | `ebook-convert file.mobi file.txt` | `calibre-bin` |\n\n> 安装依赖：`sudo apt install calibre-bin poppler-utils pandoc`\n\n---\n\n## 第二步：大文件智能分段解析\n\n### 2.1 分段策略（>10万行强制分段）\n\n```\n文件大小 < 500KB  → 一次性读取\n500KB - 2MB → 分2-4段\n2MB - 10MB → 每500行一段增量解析\n> 10MB → 每1000行一段增量解析\n```\n\n### 2.2 分段读取Shell模板\n\n```bash\n# 分段读取命令模板\ncat <小说文件> | head -n +500          # 第1段\ncat <小说文件> | tail -n +501 | head -n 500  # 第2段\ncat <小说文件> | tail -n +1001 | head -n 500 # 第3段\n# ... 以此类推\n```\n\n### 2.3 每段解析核心提取项\n\n每段必须提取并增量更新：\n- ✅ 新出场人物全名 + 别名 + 外号\n- ✅ 人物关系变化（敌对/盟友/情侣/师徒/血缘）\n- ✅ 关键剧情节点 + 时间线推进\n- ✅ 武功/功法/神器/丹药系统更新\n- ✅ 势力阵营/宗门/国家变化\n- ✅ 重要伏笔 + 世界观补全\n\n---\n\n## 第三步：人物体系标准化建模\n\n### 3.1 人物层级分类体系\n\n| 层级 | 定义标准 | 详细程度 |\n|------|---------|---------|\n| S级核心人物 | 主角团 + 最终BOSS + 关键导师 | 深度解析：性格/成长线/经典场景/漫画设定 |\n| A级重要人物 | 主要反派 + 主要盟友 + 主要女主 | 完整人物卡 |\n| B级次要人物 | 重要配角 + 各门派掌门 | 基础信息 + 立场 |\n| C级NPC | 路人甲 + 一次性炮灰 | 只计数不展开 |\n\n### 3.2 标准人物卡模板\n\n```markdown\n### 🎭 人物名称\n- **身份**：详细身份定位\n- **修为/境界**：\n- **性格特质**：3-5个核心关键词\n- **核心能力/功法**：\n- **人物关系网**：\n  - ❤️ 恋人：xxx\n  - 👨‍🏫 师父：xxx\n  - ⚔️ 死敌：xxx\n  - 👬 兄弟：xxx\n- **经典分镜/漫画设定**：\n```\n\n---\n\n## 第四步：关系图谱构建规范\n\n### 4.1 四大核心关系类型\n\n使用标准Emoji统一标记：\n| 关系类型 | Emoji标记 |\n|---------|-----------|\n| 爱情/道侣 | ❤️ 💕 |\n| 师徒/传承 | 👨‍🏫 👩‍🏫 |\n| 兄弟/战友 | 👬 🤝 |\n| 血缘/家族 | 👨‍👩‍👧 |\n| 敌对/死仇 | ⚔️ 💀 |\n| 上下级/从属 | 👑 🛡️ |\n\n### 4.2 ASCII关系总图规范\n\n```\n                    【核心主角】⭐\n           ┌───────────┼───────────┐\n        【女主1】💕  【兄弟】👬  【师父】👨‍🏫\n           │           │           │\n        家族线      战队线      功法线\n```\n\n---\n\n## 第五步：输出交付标准\n\n### 5.1 必须交付的三个文件\n\n| 交付物 | 文件名 | 内容 |\n|-------|--------|------|\n| 1 | `《书名》_人物完整谱系.md` | 完整人物体系 + 势力架构 + 功法系统 + 时间线 |\n| 2 | `《书名》_核心人物关系.md` | S级+A级人物深度解析 + 漫画分镜设定 |\n| 3 | `index.html` | TailwindCSS + SVG交互式动态图谱网页 |\n\n### 5.2 交互式网页标准组件\n\nHTML页面必须包含4个标签页：\n1. 🕸️ **关系图谱页** - SVG动态连线图\n2. 👤 **人物介绍页** - 毛玻璃人物卡片\n3. 🌍 **势力格局页** - 阵营分布 + 战力对比\n4. 🎨 **漫画设定页** - 每人画风+色彩+经典分镜\n\n---\n\n## 第六步：质量检查清单\n\n交付前必须验证：\n\n✅ **编码正确** - 无乱码、无问号、无GBK残留\n✅ **人物数量** - 长篇小说≥100人，中篇≥50人，短篇≥20人\n✅ **无遗漏** - 女主/反派/导师/兄弟四大类完整\n✅ **关系清晰** - 爱情/敌对/师徒/阵营四类关系无歧义\n✅ **世界观** - 功法/境界/神器/丹药系统完整\n\n---\n\n## 第七步：主题曲生成（可选增值服务）\n\n> 当用户要求生成主题曲、片头曲、片尾曲、OST、配乐时执行本节\n> **注意**：主题曲功能可独立使用，不需要先做完整人物分析。\n> 用户可以直接描述小说类型和想要的风格，跳过第一步到第六步直接到本节。\n\n### 7.1 推荐主题供用户挑选\n\n分析小说后，根据**类型/题材/情绪氛围**，从以下预设主题中推荐3-5个：\n\n| 主题风格 | 适用场景 | 情绪关键词 |\n|---------|---------|-----------|\n| 🔥 **热血燃战** | 主角爆发、决战、逆袭 | 燃、热血、激昂、不屈 |\n| 🌙 **古风柔情** | 爱情线、离别、思念 | 婉约、忧伤、唯美、深情 |\n| ⚔️ **江湖侠气** | 武侠小说、门派争斗 | 豪迈、洒脱、义气、快意 |\n| 🌌 **史诗宏大** | 世界观展示、神魔大战 | 庄严、壮阔、神秘、命运 |\n| ❄️ **冰冽虐心** | 悲剧结局、失去、死亡 | 压抑、悲怆、孤独、破碎 |\n| ☀️ **希望曙光** | 主角成长、胜利、重生 | 希望、温暖、崛起、救赎 |\n| 🔮 **宿命轮回** | 穿越、系统、转生 | 轮回、命运、混沌、超脱 |\n| 🌸 **青春校园** | 现代言情、校园恋爱 | 清新、甜蜜、悸动、纯真 |\n\n**用户也可以自己指定主题风格**，直接进入7.2节。\n\n### 7.2 Suno AI主题曲创作\n\n根据小说内容构建Suno提示词：\n\n#### Style字段公式\n\n```\nGenre + Mood + Era + Instruments + Vocal Style + Production + Dynamics\n```\n\n#### 小说主题曲Style参考模板\n\n**🔥 热血燃战型**\n```\nEpic xianxia battle anthem, intense heroic atmosphere, ancient Chinese fantasy,\ndrums and erhu lead, male vocalist with powerful belting, orchestral percussion,\nminor key with triumphant modulations, building from ominous intro to explosive chorus,\n90BPM D minor\n```\n\n**🌙 古风柔情型**\n```\nAncient Chinese romantic ballad, melancholic and ethereal, guqin and bamboo flute,\nfemale vocalist with soulful nasally tone, sparse arrangement with gradual orchestral layers,\n情感爆发点在副歌, Bb major 65BPM\n```\n\n**⚔️ 江湖侠气型**\n```\nWuxia martial arts world soundtrack, bold and free-spirited, traditional Chinese instruments\npipa and dizi, male vocalist with raw gritty tone, rhythmic drums with folk elements,\noutro fades to peaceful resolution, G minor 85BPM\n```\n\n**🌌 史诗宏大型**\n```\nEpic dark fantasy orchestral, divine and mysterious atmosphere, full symphonic orchestra\nwith choir, operatic male vocals with reverb, Gregorian chant elements,\n命运感强烈, E minor 120BPM\n```\n\n#### Lyrics结构标签（写在歌词中）\n\n```\n[Intro] [Verse] [Pre-Chorus] [Chorus]\n[Post-Chorus] [Bridge] [Interlude]\n[Instrumental] [Outro]\n```\n\n#### 动态标签（描述演唱情绪）\n\n| 标签 | 含义 |\n|------|------|\n| `[Powerful]` | 爆发力强 |\n| `[Whispered]` | 低语诉说 |\n| `[Soulful]` | 深情款款 |\n| `[Gritty]` | 粗犷沙哑 |\n| `[Falsetto]` | 假音飘渺 |\n| `[Building Energy]` | 渐强递进 |\n| `[Emotional Climax]` | 情感高潮 |\n\n### 7.3 主题曲与视频合成\n\n生成音频后，用ffmpeg合并视频：\n\n```bash\n# 方式一：6秒精华版（视频片段 + 歌曲开头）\nffmpeg -y -i <视频文件> -i <音频文件> \\\n  -vf \"fade=t=in:st=0:d=0.5,fade=t=out:st=5.5:d=0.5\" \\\n  -c:v libx264 -c:a aac -shortest \\\n  <输出文件>\n\n# 方式二：循环版（视频循环 + 歌曲完整版）\nffmpeg -y -stream_loop 9 -i <视频文件> -i <音频文件> \\\n  -vf \"fade=t=in:st=0:d=1,fade=t=out:st=54:d=2\" \\\n  -c:v libx264 -c:a aac -t <时长秒数> \\\n  <输出文件>\n```\n\n---\n\n## 第八步：进阶脚本（可选）\n\n> 以下脚本位于 `scripts/` 目录，执行前先验证环境，无需用户批准即可安装依赖。\n\n`scripts/chapter_split.py` - 按章节智能分割大文件\n`scripts/character_extract.py` - NLP辅助提取人名（中文分词）\n`scripts/generate_html.py` - 自动生成交互式图谱页面\n\n### 8.1 chapter_split.py（章节分割）\n\n```python\n#!/usr/bin/env python3\n\"\"\"智能章节分割脚本 - 按章节将大文件分成多个小文件\"\"\"\n\nimport re\nimport os\nimport sys\n\ndef split_by_chapters(file_path, output_dir=None):\n    \"\"\"检测章节标题并分割文件\"\"\"\n    with open(file_path, 'r', encoding='utf-8') as f:\n        content = f.read()\n\n    # 常见章节标题正则\n    chapter_pattern = re.compile(\n        r'^第[一二三四五六七八九十百千\\d]+[章节卷部篇]\\s*[：:]\\s*.+$',\n        re.MULTILINE\n    )\n\n    chapters = chapter_pattern.split(content)\n    if len(chapters) <= 1:\n        # 备选：简单按\"第X章\"分割\n        chapter_pattern = re.compile(r'第[一二三四五六七八九十百千\\d]+章')\n        chapters = chapter_pattern.split(content)\n\n    base_name = os.path.splitext(os.path.basename(file_path))[0]\n    output_dir = output_dir or os.path.dirname(file_path)\n\n    for i, chapter_content in enumerate(chapters):\n        if chapter_content.strip():\n            output_path = os.path.join(output_dir, f\"{base_name}_第{i+1}章.txt\")\n            with open(output_path, 'w', encoding='utf-8') as f:\n                f.write(chapter_content.strip())\n            print(f\"OK: {output_path}\")\n\nif __name__ == \"__main__\":\n    if len(sys.argv) < 2:\n        print(\"Usage: python chapter_split.py <novel.txt>\")\n        sys.exit(1)\n    split_by_chapters(sys.argv[1])\n```\n\n### 8.2 character_extract.py（人名提取）\n\n```python\n#!/usr/bin/env python3\n\"\"\"基于结巴分词的中文人名提取辅助工具\"\"\"\n\nimport re\nimport os\nimport sys\n\ndef extract_names(text, top_n=100):\n    \"\"\"提取文本中的中国人名（简单基于姓氏词典）\"\"\"\n    # 常见姓氏\n    surnames = r'[赵钱孙李周吴郑王冯陈褚卫蒋沈韩杨朱秦尤许何吕施张孔曹严华金魏陶姜戚谢邹喻柏水窦章云苏潘葛奚范彭郎鲁韦昌马苗凤花方俞任袁柳酆鲍史唐费廉岑薛雷贺倪汤滕殷罗毕郝邬安常乐于时傅皮卞齐康伍余元卜顾孟平黄穆萧尹姚邵堪汪祁毛禹狄米贝明臧计伏成戴谈宋茅庞熊纪舒屈项祝董梁杜阮蓝闵席季麻强贾路娄危江童颜郭梅盛林刁钟徐邱骆高夏蔡田樊胡凌霍虞万支柯咎管卢莫经房裘缪干解应宗丁宣贲邓郁单杭洪包诸左右崔吉钮龚程嵇邢滑裴陆荣翁荀羊于惠甄曲面加羊舌微巢关蒯相查后荆红游竺权逯盖益桓公万俟司马上官欧阳夏侯诸葛闻人东方赫连皇甫尉迟公羊澹台公冶宗政濮阳淳于单于太叔申屠公孙仲孙轩辕令狐钟离宇文长孙慕容鲜于闾丘司徒司空亓官司寇仉督子车颛孙端木巫马公西漆雕乐正壤驷公良拓跋夹谷宰父谷利段干百里东郭南门呼延归海羊舌微生岳帅缑亢况后有琴梁丘左丘东门西门商牟佘佴伯赏南宫墨哈谯笪年爱阳佟]'\n\n    # 简单的人名匹配（姓氏+1-2个汉字）\n    pattern = re.compile(rf'{surnames}[\\u4e00-\\u9fff]{{1,3}}')\n    names = pattern.findall(text)\n\n    # 去重并统计频率\n    name_freq = {}\n    for name in names:\n        name_freq[name] = name_freq.get(name, 0) + 1\n\n    sorted_names = sorted(name_freq.items(), key=lambda x: x[1], reverse=True)\n    return sorted_names[:top_n]\n\nif __name__ == \"__main__\":\n    if len(sys.argv) < 2:\n        print(\"Usage: python character_extract.py <novel.txt> [top_n]\")\n        sys.exit(1)\n\n    file_path = sys.argv[1]\n    top_n = int(sys.argv[2]) if len(sys.argv) > 2 else 100\n\n    with open(file_path, 'r', encoding='utf-8') as f:\n        text = f.read()\n\n    names = extract_names(text, top_n)\n    print(f\"共提取到 {len(names)} 个人名：\")\n    for name, freq in names:\n        print(f\"  {name}: {freq}次\")\n```\n\n### 8.3 generate_html.py（生成交互图谱）\n\n```python\n#!/usr/bin/env python3\n\"\"\"自动生成交互式人物关系图谱HTML\"\"\"\n\nimport os\nimport sys\n\nTEMPLATE_PATH = os.path.join(os.path.dirname(__file__), '../assets/graph_template.html')\n\ndef generate_html(title, subtitle, characters, relationships, output_path='index.html'):\n    \"\"\"生成HTML图谱\"\"\"\n\n    with open(TEMPLATE_PATH, 'r', encoding='utf-8') as f:\n        template = f.read()\n\n    # 填充标题\n    template = template.replace('{{TITLE}}', title)\n    template = template.replace('{{SUBTITLE}}', subtitle)\n\n    # 生成人物卡片HTML\n    cards_html = ''\n    for char in characters:\n        cards_html += f'''\n        <div class=\"character-card bg-gray-800/50 rounded-2xl p-6 border border-gray-700/50\">\n            <h3 class=\"text-xl font-bold text-orange-400 mb-2\">{char['name']}</h3>\n            <p class=\"text-gray-300 text-sm\">{char.get('identity', '')}</p>\n            <p class=\"text-gray-400 text-xs mt-2\">修为：{char.get('realm', '未知')}</p>\n        </div>\n        '''\n\n    # 替换占位符\n    template = template.replace('<!-- CHARACTER_CARDS -->', cards_html)\n\n    with open(output_path, 'w', encoding='utf-8') as f:\n        f.write(template)\n\n    print(f\"OK: {output_path}\")\n\nif __name__ == \"__main__\":\n    print(\"Usage: from generate_html import generate_html\")\n    print(\"       generate_html('小说名', '副标题', characters_list, relationships_list)\")\n\nFile v1.0.1:_meta.json\n\n{\n  \"ownerId\": \"kn73pfccc8e95j989m8js0x9zx82p86q\",\n  \"slug\": \"novel-character-graph\",\n  \"version\": \"1.0.1\",\n  \"publishedAt\": 1776926026962\n}\n\nFile v1.0.1:references/format_handbook.md\n\n# 小说格式处理手册\n\n## 编码问题终极解决方案\n\n### 中文小说编码问题诊断\n\n99%的中文TXT小说编码问题：\n- 老小说：GBK / GB18030 编码（起点/纵横等老站）\n- 新小说：UTF-8 编码\n- 台湾小说：BIG5 编码\n\n### 批量编码转换脚本\n\n```bash\n# 批量转换GBK→UTF-8\nfor f in *.txt; do\n    iconv -f GBK -t UTF-8 \"$f\" -o \"${f%.txt}_utf8.txt\" 2>/dev/null && mv \"${f%.txt}_utf8.txt\" \"$f\" && echo \"OK: $f\" || echo \"FAIL: $f\"\ndone\n```\n\n---\n\n## 各格式转换工具安装\n\n### EPUB/MOBI 处理\n\n```bash\n# Debian/Ubuntu\nsudo apt install calibre-bin poppler-utils pandoc\n\n# 转换命令\nebook-convert novel.epub novel.txt\nebook-convert novel.mobi novel.txt\n```\n\n### PDF 处理\n\n```bash\n# 最佳文本提取工具\npdftotext -layout novel.pdf output.txt\npdftotext -f 10 -l 100 novel.pdf output.txt  # 指定页码范围\n```\n\n### DOCX 处理\n\n```bash\npandoc -s novel.docx -o output.txt\n```\n\n---\n\n## 大文件分段Shell脚本\n\n```bash\n#!/bin/bash\n# split_novel.sh - 智能分段脚本\n\nFILE=$1\nLINES_PER_CHUNK=500\nTOTAL_LINES=$(wc -l < \"$FILE\")\nCHUNKS=$(( (TOTAL_LINES + LINES_PER_CHUNK - 1) / LINES_PER_CHUNK ))\n\necho \"Total: $TOTAL_LINES lines, split into $CHUNKS chunks\"\n\nfor i in $(seq 1 $CHUNKS); do\n    START=$(( (i-1) * LINES_PER_CHUNK + 1 ))\n    echo \"=== Chunk $i / $CHUNKS (lines $START - $((START + LINES_PER_CHUNK - 1))) ===\"\n    cat \"$FILE\" | tail -n +$START | head -n $LINES_PER_CHUNK\ndone\n```\n\nArchive v1.0.0: 6 files, 12156 bytes\n\nFiles: _meta.json (140b), examples/example_characters.py (5252b), README.md (1981b), scripts/extract_graph.py (4341b), scripts/generate_html.py (9728b), SKILL.md (5679b)\n\nFile v1.0.0:SKILL.md\n\n---\nname: novel-character-graph\ndescription: 从小说文本中提取人物关系，生成可视化人物关系图谱。当用户要求为小说绘制人物关系图、生成人物关系网络图、制作小说人物图谱时使用此技能。支持悬停查看人物详情、搜索、缩放拖拽。可处理 GBK/UTF-8 编码的中文 txt 文件。\nallowed-tools: Read, Exec, Write, Edit\n---\n\n# 小说人物关系图谱\n\n从小说文本中提取人物，构建并生成交互式人物关系可视化图谱。\n\n## 核心流程\n\n### 第一步：环境准备\n\n```bash\n# 检查依赖\npython3 -c \"import jieba, networkx, matplotlib, d3\" 2>/dev/null || pip install jieba networkx matplotlib\n```\n\n### 第二步：分析小说结构\n\n1. 读取文件（自动检测编码，支持 GBK/UTF-8/GB18030）\n2. 按章节分割（匹配 `第X章` / `第X节` / `第X集` 模式）\n3. 统计总章节数、总字数\n\n```python\nimport re\n\ndef split_chapters(text):\n    \"\"\"按章节分割小说文本\"\"\"\n    chapter_starts = []\n    for m in re.finditer(r'第[一二三四五六七八九十百千\\d]+[章节集]', text):\n        chapter_starts.append(m.start())\n    chapter_starts.append(len(text))\n    return [text[chapter_starts[i]:chapter_starts[i+1]] for i in range(len(chapter_starts)-1)]\n```\n\n### 第三步：人物提取\n\n#### 方式 A：预设人物列表（推荐）\n提供一个人物字典 `{人名: 分组}`，通过共现分析计算关系权重。\n\n```python\nCHARACTERS = {\n    '昌凡': '主角', '项涛': '主角挚友', '冰雪': '主角爱人',\n    '青龙': '超级神兽', '朱韶': '主角挚友', '酆都大帝': '鬼界',\n    # ... 覆盖小说主要人物\n}\n```\n\n#### 方式 B：从文本自动提取（辅助）\n从对话引号中提取更多角色名，过滤后追加到人物列表。\n\n```python\n# 从引号中提取人名\nadditional = defaultdict(int)\nfor ch in chapters:\n    for m in re.finditer(r'[\"\"\"](.{2,4})[\"\"\"]', ch):\n        if freq >= 50 and name not in KNOWN_CHARS:\n            additional[name] += 1\n```\n\n### 第四步：关系提取\n\n#### 共现关系（自动）\n统计每对人物在同一章节出现的次数，作为关系权重。\n\n```python\nlinks_dict = defaultdict(lambda: {'weight': 0, 'label': ''})\nfor ch in chapters:\n    chars_in_ch = [c for c in characters if c in ch]\n    for i, c1 in enumerate(chars_in_ch):\n        for c2 in chars_in_ch[i+1:]:\n            key = tuple(sorted([c1, c2]))\n            links_dict[key]['weight'] += 1\n```\n\n#### 预设关系（精确）\n为重要人物对预设关系标签，权重更高。\n\n```python\nKNOWN_RELS = {\n    ('昌凡', '冰雪'): '结发夫妻',\n    ('昌凡', '项涛'): '义弟/结义兄弟',\n    ('昌凡', '朱韶'): '师徒',\n    ('昌凡', '酆都大帝'): '生死大敌',\n    # ...\n}\n```\n\n### 第五步：生成 D3.js 可视化\n\n生成单个 HTML 文件，内嵌 D3.js 力导向图，通过 HTTP 服务器提供访问。\n\n```python\n# 输出文件: novel-character-graph.html\n# 数据文件: graph_data.json\n```\n\n核心 HTML 结构：\n- **节点颜色**：按分组（主角=金色、爱人=粉色、七星宗=蓝色、魔界=红色、鬼界=灰色等）\n- **节点大小**：按出场频率\n- **连线颜色**：强关系=金色、中=橙色、弱=深蓝\n- **交互**：悬停显示详情、搜索高亮、缩放拖拽\n\n```html\n<!DOCTYPE html>\n<html>\n<head>\n    <script src=\"https://d3js.org/d3.v7.min.js\"></script>\n    <style>\n        body { background: #0a0a0f; font-family: sans-serif; }\n        .node circle { cursor: pointer; }\n        .node text { font-size: 9px; fill: #fff; text-shadow: 0 0 2px #000; pointer-events: none; }\n        #tooltip { position: absolute; background: rgba(15,15,30,0.98); border: 1px solid #558; border-radius: 12px; padding: 16px; pointer-events: none; opacity: 0; transition: opacity 0.2s; width: 360px; }\n    </style>\n</head>\n<body>\n    <!-- D3.js force-directed graph -->\n</body>\n</html>\n```\n\n### 第六步：提供访问\n\n```bash\npython3 -m http.server 8888\n# 访问 http://localhost:8888/novel-character-graph.html\n```\n\n## 分组颜色方案\n\n| 分组 | 颜色 | 示例 |\n|------|------|------|\n| 主角 | #FFD700 | 金色 |\n| 主角爱人 | #FF6B9D | 粉色 |\n| 主角挚友 | #FF69B4 | 浅粉 |\n| 七星宗兄弟 | #4FC3F7 | 浅蓝 |\n| 七星宗 | #29B6F6 | 蓝色 |\n| 七星宗反派 | #EF5350 | 红色 |\n| 凡间 | #FF9800 | 橙色 |\n| 修妖界 | #81C784 | 绿色 |\n| 超级神兽 | #BA68C8 | 紫色 |\n| 上界/仙界 | #E040FB | 亮紫 |\n| 魔界 | #F44336 | 深红 |\n| 鬼界 | #90A4AE | 灰色 |\n\n## 注意事项\n\n1. **编码问题**：中文小说常用 GBK 编码，读取时需指定 `encoding='gbk'` 或 `errors='ignore'`\n2. **章节分割**：不同小说章节标题格式不同，可调整正则 `第[一二三四五六七八九十百千\\d]+[章节集]`\n3. **关系噪音**：自动共现关系可能包含不准确的关系，需用预设关系覆盖\n4. **人物数量**：超过200人时图会密集，可设置出场频率阈值过滤\n5. **JSON 嵌入**：大数据集直接嵌入 HTML 可能导致浏览器解析错误，应使用外部 JSON 文件 + fetch/XHR 加载\n\n## 输出格式\n\n- `graph_data.json` — 人物和关系的 JSON 数据\n- `character-graph.html` — D3.js 交互式可视化 HTML 文件\n- `python3 -m http.server 8888` — 提供本地访问的 HTTP 服务器\n\n## 人物描述丰富\n\n为每个重要角色添加 `rich_desc` 字段，包含：\n- 性格特点\n- 与主角的关系\n- 主要事迹\n\n示例：\n```json\n{\n  \"id\": \"昌凡\",\n  \"name\": \"昌凡\",\n  \"group\": \"主角\",\n  \"freq\": 528,\n  \"rich_desc\": \"主角，从凡间到上界的传奇人物。性格坚毅果敢，重情重义，有原则有担当。\"\n}\n```\n\nFile v1.0.0:README.md\n\n# 小说人物关系图谱 - Skill\n\n从小说文本中提取人物关系，生成交互式 D3.js 可视化图谱。\n\n## 功能特性\n\n- ✅ 自动检测文件编码（GBK/UTF-8/GB18030）\n- ✅ 智能章节分割\n- ✅ 人物共现关系提取\n- ✅ 预设关系标签（夫妻、师徒、仇敌等）\n- ✅ 分组着色（主角/爱人/挚友/七星宗/仙界/魔界/鬼界等）\n- ✅ 交互式 D3.js 力导向图\n- ✅ 悬停查看人物详情和关系\n- ✅ 搜索高亮\n- ✅ 缩放拖拽\n\n## 快速开始\n\n```bash\n# 启动 HTTP 服务器\ncd /path/to/novel\npython3 -m http.server 8888\n\n# 访问\nopen http://localhost:8888/character-graph.html\n```\n\n## 目录结构\n\n```\nnovel-character-graph/\n├── SKILL.md              # Skill 说明文档\n├── _meta.json            # 元数据\n├── scripts/\n│   ├── extract_graph.py  # 人物关系提取脚本\n│   └── generate_html.py  # HTML 生成脚本\n├── examples/\n│   └── example_characters.py  # 示例人物列表\n└── README.md\n```\n\n## 使用方法\n\n### 方式一：命令行\n\n```bash\n# 提取关系数据\npython3 scripts/extract_graph.py /path/to/novel.txt\n\n# 生成 HTML 可视化\npython3 scripts/generate_html.py graph_data.json character-graph.html \"小说名\"\n```\n\n### 方式二：在 OpenClaw 中使用\n\n当用户要求为小说绘制人物关系图时，此 Skill 将自动被触发，按照 SKILL.md 中的流程执行。\n\n## 依赖\n\n- Python 3.7+\n- jieba（中文分词）\n- d3.js v7（通过 CDN 加载，无需安装）\n\n## 扩展使用\n\n### 添加新人物\n\n编辑 `examples/example_characters.py`，添加人物到 `CHARACTERS` 字典：\n\n```python\nCHARACTERS = {\n    '新人物': '分组',  # 分组：主角/主角爱人/主角挚友/七星宗/上界/魔界/鬼界/其他\n}\n```\n\n### 添加预设关系\n\n编辑 `examples/example_characters.py`，添加关系到 `RELATIONSHIPS` 字典：\n\n```python\nRELATIONSHIPS = {\n    ('人物A', '人物B'): '关系描述',\n}\n```\n\nFile v1.0.0:_meta.json\n\n{\n  \"ownerId\": \"kn73pfccc8e95j989m8js0x9zx82p86q\",\n  \"slug\": \"novel-character-graph\",\n  \"version\": \"1.0.0\",\n  \"publishedAt\": 1776397160638\n}","readmeExcerpt":"Skill: Novel Character Graph Owner: mengbin92 Summary: Professional long-form novel analysis and character relationship mapping + theme song generation. Automatically handles GBK/UTF-8 encoding, multi-GB file chu... Tags: character-relationship:1.0.0, latest:1.0.2, novel:1.0.0, visualization:1.0.0 Version history: v1.0.2 | 2026-04-26T13:54:42.076Z | auto - Initial release of version 1.0.2. - Added _meta.json file. v1","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"# 1. 检测文件基本信息\nfile -i <小说文件>\nwc -l <小说文件>\nls -lh <小说文件>\n\n# 2. 编码自动修复（中文小说90%为GBK编码）\ncat <小说文件> | iconv -f GBK -t UTF-8 2>/dev/null > decoded.tmp && mv decoded.tmp <小说文件>_utf8.txt\n\n# 3. 编码失败备选方案\niconv -f GB18030 -t UTF-8 <小说文件> 2>/dev/null\niconv -f BIG5 -t UTF-8 <小说文件> 2>/dev/null"},{"language":"text","snippet":"文件大小 < 500KB  → 一次性读取\n500KB - 2MB → 分2-4段\n2MB - 10MB → 每500行一段增量解析\n> 10MB → 每1000行一段增量解析"},{"language":"bash","snippet":"# 分段读取命令模板\ncat <小说文件> | head -n +500          # 第1段\ncat <小说文件> | tail -n +501 | head -n 500  # 第2段\ncat <小说文件> | tail -n +1001 | head -n 500 # 第3段\n# ... 以此类推"},{"language":"markdown","snippet":"### 🎭 人物名称\n- **身份**：详细身份定位\n- **修为/境界**：\n- **性格特质**：3-5个核心关键词\n- **核心能力/功法**：\n- **人物关系网**：\n  - ❤️ 恋人：xxx\n  - 👨‍🏫 师父：xxx\n  - ⚔️ 死敌：xxx\n  - 👬 兄弟：xxx\n- **经典分镜/漫画设定**："},{"language":"text","snippet":"【核心主角】⭐\n           ┌───────────┼───────────┐\n        【女主1】💕  【兄弟】👬  【师父】👨‍🏫\n           │           │           │\n        家族线      战队线      功法线"},{"language":"text","snippet":"Genre + Mood + Era + Instruments + Vocal Style + Production + Dynamics"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: novel-character-graph\ndescription: \"Professional long-form novel analysis and character relationship mapping + theme song generation. Automatically handles GBK/UTF-8 encoding, multi-GB file chunking, chapter-by-chapter incremental parsing, supports TXT/EPUB/PDF/DOCX novel formats. Outputs complete character system, relationship maps, worldviews, weapon/item systems, interactive visualization HTML, and AI-generated theme songs (Suno). Use when users ask for: novel analysis, character mapping, relationship graphs, worldview architecture, story timeline organization, manga/comic adaptation settings, novel theme song, ending song, OST.\"\ntags: [novel, analysis, character, relationship, graph, xianxia, wuxia, fantasy, song, music]\ntriggers:\n  - 小说分析\n  - 人物图谱\n  - 人物关系\n  - 关系图谱\n  - 世界观\n  - 小说人物\n  - 角色设定\n  - 主题曲\n  - 片头曲\n  - 片尾曲\n  - OST\n  - 小说配乐\nrequired_commands:\n  - iconv\n  - ebook-convert\n  - pdftotext\n  - pandoc\nusage_hint: >\n  当用户提到「小说分析」「人物图谱」「关系图」「世界观」「角色设定」时使用本skill。\n  当用户提到「主题曲」「片头曲」「片尾曲」「OST」「配乐」时也使用本skill（可独立使用，\n  不需要先做完整人物分析，直接基于用户描述的小说类型/情绪生成即可）。\n---\n\n# 小说人物图谱专业分析Skill + 主题曲生成\n\n## 核心能力\n\n本Skill专业处理百万字级长篇小说深度分析，解决大文件无法一次性解析的问题，并能为小说生成专属主题曲。\n\n---\n\n## 第一步：文件预处理流程\n\n### 1.1 文件格式检测与编码修复\n\n```bash\n# 1. 检测文件基本信息\nfile -i <小说文件>\nwc -l <小说文件>\nls -lh <小说文件>\n\n# 2. 编码自动修复（中文小说90%为GBK编码）\ncat <小说文件> | iconv -f GBK -t UTF-8 2>/dev/null > decoded.tmp && mv decoded.tmp <小说文件>_utf8.txt\n\n# 3. 编码失败备选方案\niconv -f GB18030 -t UTF-8 <小说文件> 2>/dev/null\niconv -f BIG5 -t UTF-8 <小说文件> 2>/dev/null\n```\n\n### 1.2 支持的主流小说格式\n\n| 格式 | 处理方法 | 依赖命令 |\n|------|---------|---------|\n| ✅ `.txt` | 直接分段读取 | - |\n| ✅ `.epub` | `ebook-convert file.epub file.txt` | `calibre-bin` |\n| ✅ `.pdf` | `pdftotext -layout file.pdf output.txt` | `poppler-utils` |\n| ✅ `.docx` | `pandoc -s file.docx -o output.txt` | `pandoc` |\n| ✅ `.mobi` | `ebook-convert file.mobi file.txt` | `calibre-bin` |\n\n> 安装依赖：`sudo apt install calibre-bin poppler-utils pandoc`\n\n---\n\n## 第二步：大文件智能分段解析\n\n### 2.1 分段策略（>10万行强制分段）\n\n```\n文件大小 < 500KB  → 一次性读取\n500KB - 2MB → 分2-4段\n2MB - 10MB → 每500行一段增量解析\n> 10MB → 每1000行一段增量解析\n```\n\n### 2.2 分段读取Shell模板\n\n```bash\n# 分段读取命令模板\ncat <小说文件> | head -n +500          # 第1段\ncat <小说文件> | tail -n +501 | head -n 500  # 第2段\ncat <小说文件> | tail -n +1001 | head -n 500 # 第3段\n# ... 以此类推\n```\n\n### 2.3 每段解析核心提取项\n\n每段必须提取并增量更新：\n- ✅ 新出场人物全名 + 别名 + 外号\n- ✅ 人物关系变化（敌对/盟友/情侣/师徒/血缘）\n- ✅ 关键剧情节点 + 时间线推进\n- ✅ 武功/功法/神器/丹药系统更新\n- ✅ 势力阵营/宗门/国家变化\n- ✅ 重要伏笔 + 世界观补全\n\n---\n\n## 第三步：人物体系标准化建模\n\n### 3.1 人物层级分类体系\n\n| 层级 | 定义标准 | 详细程度 |\n|------|---------|---------|\n| S级核心人物 | 主角团 + 最终BOSS + 关键导师 | 深度解析：性格/成长线/经典场景/漫画设定 |\n| A级重要人物 | 主要反派 + 主要盟友 + 主要女主 | 完整人物卡 |\n| B级次要人物 | 重要配角 + 各门派掌门 | 基础信息 + 立场 |\n| C级NPC | 路人甲 + 一次性炮灰 | 只计数不展开 |\n\n### 3.2 标准人物卡模板\n\n```markdown\n### 🎭 人物名称\n- **身份**：详细身份定位\n- **修为/境界**：\n- **性格特质**：3-5个核心关键词\n- **核心能力/功法**：\n- **人物关系网**：\n  - ❤️ 恋人：xxx\n  - 👨‍🏫 师父：xxx\n  - ⚔️ 死敌：xxx\n  - 👬 兄弟：xxx\n- **经典分镜/漫画设定**：\n```\n\n---\n\n## 第四步：关系图谱构建规范\n\n### 4.1 四大核心关系类型\n\n使用标准Emoji统一标记：\n| 关系类型 | Emoji标记 |\n|---------|-----------|\n| 爱情/道侣 | ❤️ 💕 |"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn73pfccc8e95j989m8js0x9zx82p86q\",\n  \"slug\": \"novel-character-graph\",\n  \"version\": \"1.0.2\",\n  \"publishedAt\": 1777211682076\n}"},{"path":"references/format_handbook.md","content":"# 小说格式处理手册\n\n## 编码问题终极解决方案\n\n### 中文小说编码问题诊断\n\n99%的中文TXT小说编码问题：\n- 老小说：GBK / GB18030 编码（起点/纵横等老站）\n- 新小说：UTF-8 编码\n- 台湾小说：BIG5 编码\n\n### 批量编码转换脚本\n\n```bash\n# 批量转换GBK→UTF-8\nfor f in *.txt; do\n    iconv -f GBK -t UTF-8 \"$f\" -o \"${f%.txt}_utf8.txt\" 2>/dev/null && mv \"${f%.txt}_utf8.txt\" \"$f\" && echo \"OK: $f\" || echo \"FAIL: $f\"\ndone\n```\n\n---\n\n## 各格式转换工具安装\n\n### EPUB/MOBI 处理\n\n```bash\n# Debian/Ubuntu\nsudo apt install calibre-bin poppler-utils pandoc\n\n# 转换命令\nebook-convert novel.epub novel.txt\nebook-convert novel.mobi novel.txt\n```\n\n### PDF 处理\n\n```bash\n# 最佳文本提取工具\npdftotext -layout novel.pdf output.txt\npdftotext -f 10 -l 100 novel.pdf output.txt  # 指定页码范围\n```\n\n### DOCX 处理\n\n```bash\npandoc -s novel.docx -o output.txt\n```\n\n---\n\n## 大文件分段Shell脚本\n\n```bash\n#!/bin/bash\n# split_novel.sh - 智能分段脚本\n\nFILE=$1\nLINES_PER_CHUNK=500\nTOTAL_LINES=$(wc -l < \"$FILE\")\nCHUNKS=$(( (TOTAL_LINES + LINES_PER_CHUNK - 1) / LINES_PER_CHUNK ))\n\necho \"Total: $TOTAL_LINES lines, split into $CHUNKS chunks\"\n\nfor i in $(seq 1 $CHUNKS); do\n    START=$(( (i-1) * LINES_PER_CHUNK + 1 ))\n    echo \"=== Chunk $i / $CHUNKS (lines $START - $((START + LINES_PER_CHUNK - 1))) ===\"\n    cat \"$FILE\" | tail -n +$START | head -n $LINES_PER_CHUNK\ndone\n```"},{"path":"skill-card.md","content":"## Description:\n\nAnalyzes long-form novels, maps characters and relationships, prepares worldview and timeline outputs, builds interactive HTML relationship graphs, and drafts theme-song prompts.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[mengbin92](https://clawhub.ai/user/mengbin92)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers, writers, and content teams use this skill to analyze novels in TXT, EPUB, PDF, DOCX, or MOBI form and produce character systems, relationship maps, timelines, worldview notes, interactive graph reports, and song-generation prompts.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The security evidence reports that the skill explicitly allows dependency installation without user approval.\n\nMitigation: Require explicit user approval before any apt, sudo, pip, media conversion, or package-installation command is run.\n\nRisk: Generated HTML reports can expose users to unsafe content if untrusted novel data is inserted without escaping or if remote scripts are loaded.\n\nMitigation: Open generated reports only after reviewing the template and escaping behavior, and avoid remote script loading for untrusted inputs.\n\nRisk: Preprocessing and conversion commands can overwrite or transform source novel files.\n\nMitigation: Keep backups of source novels and write converted files, split chapters, Markdown reports, and HTML outputs to a separate working directory.\n\n## Reference(s):\n\n- [Format Handbook](references/format_handbook.md)\n- [ClawHub Skill Page](https://clawhub.ai/mengbin92/skills/novel-character-graph)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance, files]\n\n**Output Format:** [Markdown, shell commands, Python-generated HTML, and Suno-style song prompt text]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Can create novel analysis Markdown files and an interactive HTML relationship graph; users should review commands and generated HTML before use.]\n\n## Skill Version(s):\n\n1.0.2 (source: server release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment."}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"Professional long-form novel analysis and character relationship mapping + theme song generation. Automatically handles GBK/UTF-8 encoding, multi-GB file chu... Skill: Novel Character Graph Owner: mengbin92 Summary: Professional long-form novel analysis and character relationship mapping + theme song generation. Automatically handles GBK/UTF-8 encoding, multi-GB file chu... Tags: character-relationship:1.0.0, latest:1.0.2, novel:1.0.0, visualization:1.0.0 Version history: v1.0.2 | 2026-04-26T13:54:42.076Z | auto - Initial release of version 1.0.2. - Added _meta.json file. v1","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":996,"uniquenessScore":53,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-12T02:40:07.610Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-12T02:40:07.610Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-13T18:57:12.920Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}