最新资讯
dev.to 你的 Agent Harness 应具备的 17 项能力 dev.to 离线 AI 记忆中 0.8 余弦阈值为何失效 dev.to Kimi K3.1 Pro 开放权重:自托管 2.8T 模型前的开发者清单 dev.to 如何通过工具调用引导模型以提升 Harness 质量 dev.to AI Agent 审计轨迹不等于对话记录 dev.to 精简 MCP server 工具数量:更少工具、更小影响面,双重收益 dev.to 为什么 git checkout 无法撤销 AI 编码 agent 的改动? wechat AI短剧门槛降降降!实测即梦短剧工作室:剧本分镜预演一条龙,伙伴计划长期护航 dev.to 让模型改写文档前,先量化事实保真度 dev.to 回放 153 个 Claude Code 与 Codex 会话,审计 Agent 的生产影响范围 dev.to 银行 77 意图分类最便宜 LLM:GPT-6.1 Terra 每次成功任务 $0.000727 theinformation.com Chesky的副业:Airbnb向CEO新设AI实验室出售IP
多元动态
登录 注册
开源工具 dev.to · @ArshTechPro

Docling:为 AI 应用把杂乱文档转为干净数据

原文 我的收藏

Docling 是一个开源 Python 库,用于将 PDF、Word、幻灯片、扫描图像等文档转换为 Markdown、HTML 或 JSON 等结构化输出,以解决基础 PDF 转文本工具中表格错乱、双栏阅读顺序错误、页眉混入正文等问题。它由 IBM Research Zurich 发起,现由 LF AI & Data Foundation 托管,采用 MIT 许可,支持 PDF、DOCX、PPTX、XLSX、HTML、EPUB、图像、LaTeX、邮件等输入格式,并尝试识别版面与阅读顺序、重建表格、识别代码块、公式和图像。

AI推荐理由 介绍 IBM Research Zurich 发起、现由 LF AI & Data Foundation 托管的开源文档解析库 Docling,支持 PDF、DOCX、PPTX 等格式并输出 Markdown/HTML/JSON,能识别版面、阅读顺序、表格、代码块与公式,对 RAG 数据清洗有实际用途。摘要提及 GitHub 星数,但星数不能证明工具实际效果,且正文被截断。

74

正文

The problem If you've built anything with LLMs, you've hit this wall: your data lives in PDFs, Word files, slide decks, and scanned images. You need clean text to feed a model or a RAG pipeline. Basic PDF-to-text tools give you a jumbled mess: tables collapse into random lines, two-column layouts get read in the wrong order, and headers mix with body text. Docling is an open-source Python library built to solve exactly that. What Docling is Docling reads documents and converts them into structured output such as Markdown, HTML, or JSON. It was started by IBM Research Zurich, is now hosted by the LF AI & Data Foundation, and is MIT licensed. It has over 66k stars on GitHub, so it's far from a side project. What sets it apart from a plain text extractor is that it tries to understand the page. It detects layout and reading order, rebuilds tables, and recognizes code blocks, formulas, and images. What it supports Input formats include PDF, DOCX, PPTX, XLSX, HTML, EPUB, images, LaTeX, email files, and even audio and video (transcribed with speech recognition models). Scanned PDFs are handled with OCR. Everything is converted into one internal format called DoclingDocument, which you can then export as Markdown, HTML, or lossless JSON. That means your downstream code deals with one structure no matter what the input was. Getting started You need Python 3.10 or newer. pip install docling Enter fullscreen mode Exit fullscreen mode Convert a document from the command line: docling https://arxiv.org/pdf/2206.01062 Enter fullscreen mode Exit fullscreen mode This writes a .md file to your current directory. Or use it from Python: from docling.document_converter import DocumentConverter converter = DocumentConverter() result = converter.convert("https://arxiv.org/pdf/2408.09869") print(result.document.export_to_markdown()) Enter fullscreen mode Exit fullscreen mode That's it. Local file paths work the same way as URLs. Where it fits in your stack Docling has ready-made integrations with LangChain, LlamaIndex, CrewAI, and Haystack, so you can drop it into an existing RAG pipeline as the document loader. It also ships an MCP server for connecting it to AI agents, and an API server (docling-serve) if you'd rather run it as a service than import it as a library. It runs fully locally, which matters if you're handling sensitive documents or working in an air-gapped environment. No data has to leave your machine. Is it worth a try? Yes, if any of these describe you: You're building a RAG system or chatbot over real-world documents. You have PDFs with tables that other tools mangle. You need to process many file types without writing a separate parser for each. You can't send documents to a third-party API. A few honest caveats. Docling uses machine learning models for layout and table detection, so the install is heavier than a lightweight library like pypdf, and models are downloaded on first run. Processing large PDF batches on CPU can be slow, and a GPU helps a lot. If all you need is raw text from simple, single-column PDFs, a lighter tool will do the job with less overhead. Links GitHub: https://github.com/docling-project/docling

来源报道 · 1 篇 · 以下链接均前往原始媒体

← 返回精选动态 原文

更多内容