用途:从PDF和扫描文档中提取文本与结构化内容。远程文件优先使用web_extract转换PDF为Markdown,无需本地依赖;仅当文件在本地、web_extract失败或需批量处理时才用本地提取。本地工具二选一:pymupdf轻量(约25MB、即时、无模型),适合文本型PDF与基础表格,支持EPUB及通过pymupdf4llm输出Markdown;marker-pdf(约3-5GB)负责OCR、扫描件、公式、表单、复杂版式与90多种语言,输出更高质量,首次使用会下载约2.5GB模型。安装命令:pip install pymupdf pymupdf4llm 或 pip install marker-pdf。用法:脚本 python scripts/extract_pymupdf.py document.pdf 可加 --markdown、--tables、--images out/、--metadata、--pages 0-4;marker 用 python scripts/extract_marker.py document.pdf,可加 --json、--output_dir、--use_llm,命令行还有 marker_single 与 marker 批处理。pymupdf还支持拆分、合并与搜索文本。限制:标记工具需约5GB空余磁盘;DOCX应使用python-docx,PPTX参见powerpoint技能;为URL优先web_extract。
ocr-and-documents
办公与效率
更新于 10-16 07:15