Files
lyxy-document/openspec/changes/archive/2026-03-08-unify-document-readers/proposal.md
lanyuanxiaoyao 833018d451 feat: 统一文档解析器项目 - 迁移 lyxy-reader-office 和 lyxy-reader-html
## 功能特性

- 建立统一的项目结构,包含 core/、readers/、utils/、tests/ 模块
- 迁移 lyxy-reader-office 的所有解析器(docx、xlsx、pptx、pdf)
- 迁移 lyxy-reader-html 的所有解析器(html、url 下载)
- 统一 CLI 入口为 lyxy_document_reader.py
- 统一 Markdown 后处理逻辑
- 按文件类型组织 readers,每个解析器独立文件
- 依赖分组按文件类型细分(docx、xlsx、pptx、pdf、html、http)
- PDF OCR 解析器优先,无参数控制
- 使用 logging 模块替代简单 print
- 设计完整的单元测试结构
- 重写项目文档

## 新增目录/文件

- core/ - 核心模块(异常体系、Markdown 工具、解析调度器)
- readers/ - 格式阅读器(base.py + docx/xlsx/pptx/pdf/html)
- utils/ - 工具函数(文件类型检测)
- tests/ - 测试(conftest.py + test_core/ + test_readers/ + test_utils/)
- lyxy_document_reader.py - 统一 CLI 入口

## 依赖分组

- docx - DOCX 文档解析支持
- xlsx - XLSX 文档解析支持
- pptx - PPTX 文档解析支持
- pdf - PDF 文档解析支持(含 OCR)
- html - HTML/URL 解析支持
- http - HTTP/URL 下载支持
- office - Office 格式组合(docx/xlsx/pptx/pdf)
- web - Web 格式组合(html/http)
- full - 完整功能
- dev - 开发依赖
2026-03-08 13:46:37 +08:00

41 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## Why
当前有两个独立的文档解析 skilllyxy-reader-office 和 lyxy-reader-html功能存在大量重复维护成本高。将它们统一到 lyxy-document 项目中,可以减少代码重复、便于后续扩展,并提供更一致的使用体验。
## What Changes
- 建立统一的项目结构,包含 core、readers、utils 等模块
- 迁移 lyxy-reader-office 的所有解析器docx、xlsx、pptx、pdf
- 迁移 lyxy-reader-html 的所有解析器html、url 下载)
- 统一 CLI 入口为 lyxy_document_reader.py
- 统一 Markdown 后处理逻辑
- 按文件类型组织 readers每个解析器独立文件
- 依赖分组按文件类型细分docx、xlsx、pptx、pdf、html、http
- PDF OCR 解析器优先,无参数控制
- 使用 logging 模块替代简单 print
- 设计完整的单元测试和集成测试
- 重写项目文档,不迁移原 skill 的 references 文档
## Capabilities
### New Capabilities
- `document-reading`: 统一的文档读取核心能力,包含 CLI 入口、解析调度、Markdown 后处理
- `docx-reader`: DOCX 文档解析能力
- `xlsx-reader`: XLSX 文档解析能力
- `pptx-reader`: PPTX 文档解析能力
- `pdf-reader`: PDF 文档解析能力(含 OCR
- `html-reader`: HTML/URL 解析能力
### Modified Capabilities
(无现有能力需要修改)
## Impact
- 新增目录core/、readers/、utils/、tests/
- 新增入口文件lyxy_document_reader.py
- 更新 pyproject.toml添加依赖分组
- 新增自定义异常体系
- 受影响的依赖docling、unstructured、markitdown、trafilatura、domscribe、html2text、beautifulsoup4、httpx、pyppeteer、selenium、python-docx、python-pptx、pandas、tabulate、pypdf、pypandoc-binary、unstructured-paddleocr