Feat: support epub parsing (#13650)

Closes #1398

### What problem does this PR solve?

Adds native support for EPUB files. EPUB content is extracted in spine
(reading) order and parsed using the existing HTML parser. No new
dependencies required.

### Type of change

- [x] New Feature (non-breaking change which adds functionality)

To check this parser manually:

```python
uv run --python 3.12 python -c "
from deepdoc.parser import EpubParser

with open('$HOME/some_epub_book.epub', 'rb') as f:
  data = f.read()

sections = EpubParser()(None, binary=data, chunk_token_num=512)
print(f'Got {len(sections)} sections')
for i, s in enumerate(sections[:5]):
  print(f'\n--- Section {i} ---')
  print(s[:200])
"
```
This commit is contained in:
Daniil Sivak
2026-03-17 15:14:06 +03:00
committed by GitHub
parent 1399c60164
commit 60ad32a0c2
7 changed files with 598 additions and 43 deletions

View File

@ -15,6 +15,7 @@
#
from .docx_parser import RAGFlowDocxParser as DocxParser
from .epub_parser import RAGFlowEpubParser as EpubParser
from .excel_parser import RAGFlowExcelParser as ExcelParser
from .html_parser import RAGFlowHtmlParser as HtmlParser
from .json_parser import RAGFlowJsonParser as JsonParser
@ -29,6 +30,7 @@ __all__ = [
"PdfParser",
"PlainParser",
"DocxParser",
"EpubParser",
"ExcelParser",
"PptParser",
"HtmlParser",
@ -37,4 +39,3 @@ __all__ = [
"TxtParser",
"MarkdownElementExtractor",
]