899功能EPUB提取器43645796
tools-only2026-10-25查看 1457复制 709
定义从EPUB文件中提取干净文本以进行验证的需求。
📘如何使用这个技能
- 1复制技能内容·点击上方「Copy SKILL.md」复制全部内容,或 Download 下载到本地
- 2打开你的 AI 客户端·支持 Claude Code、Trae、Cursor、ChatGPT、DeepSeek、Kimi 等任意 AI 助手
- 3粘贴为系统提示/知识文件·Claude Code:放入 .claude/skills/ 目录;普通对话:作为首条消息发送并说「请严格按这份技能文档执行」
- 4直接提出你的需求·AI 会按技能定义的工作流、格式和约束来处理,无需再解释背景
💡 提示:技能生效后,每次对话只需一句需求,AI 会按 SKILL.md 的流程执行。
SKILL.md2114 chars
--- phase: requirements title: Requirements - EPUB Extractor description: Define requirements for extracting clean text from EPUB files for validation. --- # Requirements & Problem Understanding ## Problem Statement **What problem are we solving?** - EPUB files are ZIP archives containing multiple XHTML files, images, and metadata. - To validate conversion quality, we need a single stream of text that represents the book's content. - We must remove all markup (HTML tags) and technical noise without losing the actual content or changing its order. ## Goals & Objectives **What do we want to achieve?** - **Markup Stripping:** Efficiently remove all HTML tags, leaving only human-readable text. - **Chapter Ordering:** Extract text from chapters in the correct sequence as defined by the EPUB spine. - **Canonicalization:** Mandatory integration with `text_canonicalizer`. - **Metadata extraction:** Extract basic info like Title and Creator. ## User Stories & Use Cases **How will users interact with the solution?** - As a validator, I want to get the full book text from an EPUB to check for missing segments. - As a developer, I want to handle EPUB 2 and EPUB 3 formats consistently. - As a system, I want to ignore non-content files (CSS, images, font files) automatically. ## Success Criteria **How will we know when we're done?** - `pdf_to_epub/core/epub_extractor.py` is implemented using `ebooklib` and `BeautifulSoup4`. - Text is extracted in the correct reading order. - No HTML tags remain in the output. - All extracted text is canonicalized. ## Constraints & Assumptions **What limitations do we need to work within?** - We assume the EPUB is not DRM-protected (encrypted). - We use `ebooklib` as the primary parsing engine. ## Questions & Open Items **What do we still need to clarify?** - How to handle footnotes that might appear mid-text in the XHTML? (Decision: For v1, extract them as they appear in the flow. This remains a known limitation for comparison accuracy). - How to handle images? (Decision: Images and their alt-texts are ignored in v1 to focus on pure text body).