[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-allenai--papermage":3,"tool-allenai--papermage":64},[4,17,27,35,43,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",138956,2,"2026-04-05T11:33:21",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,26,54],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":69,"readme_en":70,"readme_zh":71,"quickstart_zh":72,"use_case_zh":73,"hero_image_url":74,"owner_login":75,"owner_name":76,"owner_avatar_url":77,"owner_bio":78,"owner_company":79,"owner_location":79,"owner_email":80,"owner_twitter":79,"owner_website":81,"owner_url":82,"languages":83,"stars":92,"forks":93,"last_commit_at":94,"license":95,"difficulty_score":23,"env_os":96,"env_gpu":97,"env_ram":97,"env_deps":98,"category_tags":106,"github_topics":107,"view_count":23,"oss_zip_url":79,"oss_zip_packed_at":79,"status":16,"created_at":115,"updated_at":116,"faqs":117,"releases":148},3863,"allenai\u002Fpapermage","papermage","library supporting NLP and CV research on scientific papers","PaperMage 是一款专为科研论文处理设计的开源工具库，旨在支持自然语言处理（NLP）与计算机视觉（CV）领域的研究。它主要解决了从复杂排版的科学 PDF 文档中高效提取、表示和操作结构化信息的难题，将非结构化的论文内容转化为机器可理解的多层数据模型。\n\n该工具非常适合 AI 研究人员、开发者以及需要构建文献分析系统的数据科学家使用。其核心亮点在于独特的“分层实体”架构：PaperMage 不仅提取纯文本，还能将论文解析为页面、行、句子、章节、公式、图表等多种逻辑层级（Layer）。更强大的是，这些层级之间存在动态的空间关联索引，用户可以轻松查询任意两个层级间的交集关系（例如获取某句话所在的具体行，或某页包含的所有公式），而无需手动计算坐标重叠。\n\n尽管目前 PaperMage 处于研究原型阶段，官方建议关注其后续功能在 Dolma 项目中的演进，但它提供的统一数据表示方法，仍为构建引文问答系统、文献挖掘工具等应用提供了坚实的基础设施，显著降低了处理科学文献的技术门槛。","# papermage\n\n⚠️ This project is a research prototype for EMNLP 2023. Due to other project priorities, we are unlikely to be addressing issues \u002F maintaining this on a regular cadence. We are working on related scientific PDF parsing functionality under the [Dolma](https:\u002F\u002Fgithub.com\u002Fallenai\u002Fdolma) project banner, so please keep an eye there for a new release on the horizon. Thanks!\n\n### Setup\n\n```python\nconda create -n papermage python=3.11\nconda activate papermage\n```\n\nIf you're installing from source:\n```\npip install -e '.[dev,predictors,visualizers]'\n```\n\nIf you're installing from PyPi:\n```\npip install 'papermage[dev,predictors,visualizers]'\n```\n\n(you may need to add\u002Fremove quotes depending on your command line shell).\n\n\nIf you're on MacOSX, you'll also want to run:\n```\nconda install poppler\n```\n\n\n## Unit testing\n```bash\npython -m pytest\n```\nfor latest failed test\n```bash\npython -m pytest --lf --no-cov -n0\n```\nfor specific test name of class name\n```bash\npython -m pytest -k 'TestPDFPlumberParser' --no-cov -n0\n```\n\n## Quick start\n\n#### 1. Create a Document for the first time from a PDF\n```\nfrom papermage.recipes import CoreRecipe\n\nrecipe = CoreRecipe()\ndoc = recipe.run(\"tests\u002Ffixtures\u002Fpapermage.pdf\")\n```\n\n#### 2. Understanding the output: the `Document` class\n\nWhat is a `Document`? At minimum, it is some text, saved under the `.symbols` layer, which is just a `\u003Cstr>`.  For example:\n\n```python\n> doc.symbols\n\"PaperMage: A Unified Toolkit for Processing, Representing, and\\nManipulating Visually-...\"\n```\n\nBut this library is really useful when you have multiple different ways of segmenting `.symbols`. For example, segmenting the paper into Pages, and then each page into Rows:\n\n```python\nfor page in doc.pages:\n    print(f'\\n=== PAGE: {page.id} ===\\n\\n')\n    for row in page.rows:\n        print(row.text)\n        \n...\n=== PAGE: 5 ===\n\n4\nVignette: Building an Attributed QA\nSystem for Scientific Papers\nHow could researchers leverage papermage for\ntheir research? Here, we walk through a user sce-\nnario in which a researcher (Lucy) is prototyping\nan attributed QA system for science.\nSystem Design.\nDrawing inspiration from Ko\n...\n```\n\nThis shows two nice aspects of this library:\n\n* `Document` provides iterables for different segmentations of `symbols`.  Options include things like `pages, tokens, rows, sentences, sections, ...`.  Not every Parser will provide every segmentation, though.\n\n* Each one of these segments (in our library, we call them `Entity` objects) is aware of (and can access) other segment types. For example, you can call `page.rows` to get all Rows that intersect a particular Page. Or you can call `sent.tokens` to get all Tokens that intersect a particular Sentence. Or you can call `sent.rows` to get the Row(s) that intersect a particular Sentence. These indexes are built *dynamically* when the `Document` is created and each time a new `Entity` type is added. In the extreme, as long as those layers are available in the Document, you can write:\n\n```python\nfor page in doc.pages:\n    for sent in page.sentences:\n        for row in sent.rows: \n            ...\n```\n\nYou can check which layers are available in a Document via:\n\n```python\n> doc.layers\n['tokens',\n 'rows',\n 'pages',\n 'words',\n 'sentences',\n 'blocks',\n 'vila_entities',\n 'titles',\n 'authors',\n 'abstracts',\n 'keywords',\n 'sections',\n 'lists',\n 'bibliographies',\n 'equations',\n 'algorithms',\n 'figures',\n 'tables',\n 'captions',\n 'headers',\n 'footers',\n 'footnotes',\n 'symbols',\n 'images',\n 'metadata',\n 'entities',\n 'relations']\n```\n\n#### 3. Understanding intersection of Entities\n\nNote that `Entity`s don't necessarily perfectly nest each other. For example, what happens if you run:\n\n```python\nfor sent in doc.sentences:\n    for row in sent.rows:\n        print([token.text for token in row.tokens])\n```\n\nTokens that are *outside* each sentence can still be printed. This is because when we jump from a sentence to its rows, we are looking for *all* rows that have *any* overlap with the sentence. Rows can extend beyond sentence boundaries, and as such, can contain tokens outside that sentence.\n\nA key aspect of using this library is understanding how these different layers are defined & anticipating how they might interact with each other. We try to make decisions that are intuitive, but we do ask users to experiment with layers to build up familiarity.\n\n\n\n#### 4. What's in an `Entity`?\n\nEach `Entity` object stores information about its contents and position:\n\n* `.spans: List[Span]`, A `Span` is a pointer into `Document.symbols` (that is, `Span(start=0, end=5)` corresponds to `symbols[0:5]`). By default, when you iterate over an `Entity`, you iterate over its `.spans`.\n\n* `.boxes: List[Box]`, A `Box` represents a rectangular region on the page. Each span is associated a Box.\n\n* `.metadata: Metadata`, A free form dictionary-like object to store extra metadata about that `Entity`. These are usually empty.\n\n\n\n#### 5. How can I manually create my own `Document`?\n\nA `Document` is created by stitching together 3 types of tools: `Parsers`, `Rasterizers` and `Predictors`.\n\n* `Parsers` take a PDF as input and return a `Document` compared of `.symbols` and other layers. The example one we use is a wrapper around [PDFPlumber](https:\u002F\u002Fgithub.com\u002Fjsvine\u002Fpdfplumber) - MIT License utility.\n\n* `Rasterizers` take a PDF as input and return an `Image` per page that is added to `Document.images`. The example one we use is [PDF2Image](https:\u002F\u002Fgithub.com\u002FBelval\u002Fpdf2image) - MIT License. \n\n* `Predictors` take a `Document` and apply some operation to compute a new set of `Entity` objects that we can insert into our `Document`. These are all built in-house and can be either simple heuristics or full machine-learning models.\n\n\n\n#### 6. How can I save my `Document`?\n\n```python\nimport json\nwith open('filename.json', 'w') as f_out:\n    json.dump(doc.to_json(), f_out, indent=4)\n```\n\nwill produce something akin to:\n```python\n{\n    \"symbols\": \"PaperMage: A Unified Toolkit for Processing, Representing, an...\",\n    \"entities\": {\n        \"rows\": [...],\n        \"tokens\": [...],\n        \"words\": [...],\n        \"blocks\": [...],\n        \"sentences\": [...]\n    },\n    \"metadata\": {...}\n}\n```\n\n\n#### 7. How can I load my `Document`?\n\nThese can be used to reconstruct a `Document` again via:\n\n```python\nwith open('filename.json') as f_in:\n    doc_dict = json.load(f_in)\n    doc = Document.from_json(doc_dict)\n```\n\n\nNote: A common pattern for adding layers to a document is to load in a previously saved document, run some additional `Predictors` on it, and save the result.\n\nSee `papermage\u002Fpredictors\u002FREADME.md` for more information about training custom predictors on your own data.\n\nSee `papermage\u002Fexamples\u002Fquick_start_demo.ipynb` for a notebook walking through some more usage patterns.\n","# papermage\n\n⚠️ 本项目是EMNLP 2023的一份研究原型。由于其他项目的优先级较高，我们可能不会定期修复问题或维护该项目。目前，我们在[Dolma](https:\u002F\u002Fgithub.com\u002Fallenai\u002Fdolma)项目下开发相关的科学PDF解析功能，请关注该仓库即将发布的版本。感谢！\n\n### 设置\n\n```python\nconda create -n papermage python=3.11\nconda activate papermage\n```\n\n如果您从源代码安装：\n```\npip install -e '.[dev,predictors,visualizers]'\n```\n\n如果您从PyPI安装：\n```\npip install 'papermage[dev,predictors,visualizers]'\n```\n\n（根据您的命令行shell，可能需要添加或移除引号）。\n\n如果您使用的是MacOSX，还需要运行：\n```\nconda install poppler\n```\n\n## 单元测试\n```bash\npython -m pytest\n```\n查看最新失败的测试：\n```bash\npython -m pytest --lf --no-cov -n0\n```\n针对特定测试类名：\n```bash\npython -m pytest -k 'TestPDFPlumberParser' --no-cov -n0\n```\n\n## 快速入门\n\n#### 1. 从PDF首次创建文档\n```\nfrom papermage.recipes import CoreRecipe\n\nrecipe = CoreRecipe()\ndoc = recipe.run(\"tests\u002Ffixtures\u002Fpapermage.pdf\")\n```\n\n#### 2. 理解输出：`Document`类\n\n什么是`Document`？至少它包含一些文本，存储在`.symbols`层中，即一个字符串。例如：\n\n```python\n> doc.symbols\n\"PaperMage: A Unified Toolkit for Processing, Representing, and\\nManipulating Visually-...\"\n```\n\n但当您有多种不同的方式来分割`.symbols`时，这个库就显得非常有用。例如，将论文分割成页面，再将每个页面分割成行：\n\n```python\nfor page in doc.pages:\n    print(f'\\n=== PAGE: {page.id} ===\\n\\n')\n    for row in page.rows:\n        print(row.text)\n        \n...\n=== PAGE: 5 ===\n\n4\nVignette: Building an Attributed QA\nSystem for Scientific Papers\nHow could researchers leverage papermage for\ntheir research? Here, we walk through a user sce-\nnario in which a researcher (Lucy) is prototyping\nan attributed QA system for science.\nSystem Design.\nDrawing inspiration from Ko\n...\n```\n\n这展示了该库的两个优点：\n\n* `Document`提供了不同层次分割`symbols`的可迭代对象。选项包括`pages、tokens、rows、sentences、sections`等。不过，并非每个解析器都会提供所有这些分割。\n\n* 这些分割单元（在我们的库中称为`Entity`对象）能够感知并访问其他类型的分割。例如，您可以调用`page.rows`来获取与特定页面相交的所有行。或者调用`sent.tokens`来获取与特定句子相交的所有标记。又或者调用`sent.rows`来获取与特定句子相交的行。这些索引是在创建`Document`时以及每次新增`Entity`类型时动态构建的。极端情况下，只要文档中存在这些层，您就可以这样写：\n\n```python\nfor page in doc.pages:\n    for sent in page.sentences:\n        for row in sent.rows: \n            ...\n```\n\n您可以通过以下方式检查文档中可用的层：\n\n```python\n> doc.layers\n['tokens',\n 'rows',\n 'pages',\n 'words',\n 'sentences',\n 'blocks',\n 'vila_entities',\n 'titles',\n 'authors',\n 'abstracts',\n 'keywords',\n 'sections',\n 'lists',\n 'bibliographies',\n 'equations',\n 'algorithms',\n 'figures',\n 'tables',\n 'captions',\n 'headers',\n 'footers',\n 'footnotes',\n 'symbols',\n 'images',\n 'metadata',\n 'entities',\n 'relations']\n```\n\n#### 3. 理解实体之间的交集\n\n请注意，`Entity`之间并不一定完全嵌套。例如，如果您运行以下代码会怎样：\n\n```python\nfor sent in doc.sentences:\n    for row in sent.rows:\n        print([token.text for token in row.tokens])\n```\n\n即使某些标记位于句子之外，它们仍然会被打印出来。这是因为当我们从句子跳转到其行时，我们寻找的是与该句子有任何重叠的所有行。行可能会超出句子的边界，因此其中可能包含句子之外的标记。\n\n使用此库的关键在于理解这些不同层是如何定义的，并预见它们之间可能的交互方式。我们尽量做出直观的设计，但也鼓励用户通过实验来熟悉各个层。\n\n#### 4. `Entity`中包含什么？\n\n每个`Entity`对象都存储了关于其内容和位置的信息：\n\n* `.spans: List[Span]`，`Span`是指向`Document.symbols`的指针（即`Span(start=0, end=5)`对应于`symbols[0:5]`）。默认情况下，遍历`Entity`时，您实际上是在遍历它的`.spans`。\n\n* `.boxes: List[Box]`，`Box`表示页面上的矩形区域。每个`Span`都关联一个`Box`。\n\n* `.metadata: Metadata`，这是一个类似字典的自由格式对象，用于存储关于该`Entity`的额外元数据。通常这些字段是空的。\n\n\n\n#### 5. 如何手动创建自己的`Document`？\n\n`Document`是通过拼接三种工具创建的：`Parsers`、`Rasterizers`和`Predictors`。\n\n* `Parsers`以PDF为输入，返回包含`.symbols`和其他层的`Document`。我们使用的示例是一个基于[PDFPlumber](https:\u002F\u002Fgithub.com\u002Fjsvine\u002Fpdfplumber)的封装——MIT许可证工具。\n\n* `Rasterizers`以PDF为输入，为每页生成一张图像，并将其添加到`Document.images`中。我们使用的示例是[PDF2Image](https:\u002F\u002Fgithub.com\u002FBelval\u002Fpdf2image)——MIT许可证工具。\n\n* `Predictors`接收一个`Document`并应用某种操作，计算出一组新的`Entity`对象，然后将其插入到我们的`Document`中。这些预测器都是内部开发的，可以是简单的启发式方法，也可以是完整的机器学习模型。\n\n\n\n#### 6. 如何保存我的`Document`？\n\n```python\nimport json\nwith open('filename.json', 'w') as f_out:\n    json.dump(doc.to_json(), f_out, indent=4)\n```\n\n将会生成类似以下的内容：\n```python\n{\n    \"symbols\": \"PaperMage: A Unified Toolkit for Processing, Representing, an...\",\n    \"entities\": {\n        \"rows\": [...],\n        \"tokens\": [...],\n        \"words\": [...],\n        \"blocks\": [...],\n        \"sentences\": [...]\n    },\n    \"metadata\": {...}\n}\n```\n\n\n#### 7. 如何加载我的`Document`？\n\n可以使用以下代码重新构建一个`Document`：\n\n```python\nwith open('filename.json') as f_in:\n    doc_dict = json.load(f_in)\n    doc = Document.from_json(doc_dict)\n```\n\n\n注意：一种常见的模式是先加载之前保存的文档，然后在其基础上运行一些额外的`Predictors`，最后保存结果。\n\n有关如何使用您自己的数据训练自定义预测器的更多信息，请参阅`papermage\u002Fpredictors\u002FREADME.md`。\n\n更多使用模式请参考`papermage\u002Fexamples\u002Fquick_start_demo.ipynb`笔记本。","# PaperMage 快速上手指南\n\nPaperMage 是一个用于处理、表示和操作科学论文视觉结构的统一工具包。它能够将 PDF 解析为包含多层级语义（如页面、行、句子、公式等）的结构化文档对象。\n\n> **注意**：本项目目前是 EMNLP 2023 的研究原型，维护频率较低。相关的科学 PDF 解析功能正在 [Dolma](https:\u002F\u002Fgithub.com\u002Fallenai\u002Fdolma) 项目中开发，建议关注该项目的后续发布。\n\n## 环境准备\n\n### 系统要求\n- **操作系统**：Linux, macOS, Windows\n- **Python 版本**：推荐 Python 3.11\n- **macOS 用户特别依赖**：需要安装 `poppler` 库以支持 PDF 渲染。\n\n### 前置依赖\n在开始安装前，请确保已安装 `conda` (推荐) 或具备相应的 Python 环境。\n\n**macOS 用户必做：**\n```bash\nconda install poppler\n```\n\n## 安装步骤\n\n推荐使用 `conda` 创建独立虚拟环境以避免依赖冲突。\n\n### 1. 创建并激活环境\n```bash\nconda create -n papermage python=3.11\nconda activate papermage\n```\n\n### 2. 安装 PaperMage\n\n**方式 A：从源码安装（推荐开发者使用）**\n克隆仓库后，在项目根目录运行：\n```bash\npip install -e '.[dev,predictors,visualizers]'\n```\n\n**方式 B：从 PyPI 安装**\n```bash\npip install 'papermage[dev,predictors,visualizers]'\n```\n*(注：根据命令行外壳不同，可能需要调整引号的使用)*\n\n> **国内加速提示**：如遇下载缓慢，可添加清华或阿里镜像源：\n> `pip install -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple 'papermage[dev,predictors,visualizers]'`\n\n## 基本使用\n\n### 1. 解析 PDF 生成文档\n使用内置的 `CoreRecipe` 即可快速将 PDF 转换为 `Document` 对象。\n\n```python\nfrom papermage.recipes import CoreRecipe\n\n# 初始化配方\nrecipe = CoreRecipe()\n\n# 运行解析，输入为 PDF 文件路径\ndoc = recipe.run(\"tests\u002Ffixtures\u002Fpapermage.pdf\")\n```\n\n### 2. 访问文档内容\n`Document` 对象的核心是 `.symbols`（纯文本），但其强大之处在于提供了多种层级切片（Layers），如 `pages`, `rows`, `sentences`, `tokens` 等。\n\n**查看原始文本：**\n```python\nprint(doc.symbols)\n```\n\n**按层级遍历（例如：按页 -> 按行）：**\n```python\nfor page in doc.pages:\n    print(f'\\n=== PAGE: {page.id} ===\\n')\n    for row in page.rows:\n        print(row.text)\n```\n\n**查看可用的所有层级：**\n```python\nprint(doc.layers)\n# 输出示例：['tokens', 'rows', 'pages', 'sentences', 'figures', 'tables', ...]\n```\n\n### 3. 理解实体（Entity）与交叉引用\nPaperMage 中的每个片段（如句子、行）都是一个 `Entity` 对象。它们之间不是严格的嵌套关系，而是基于空间重叠的动态关联。\n\n你可以轻松跨越层级查询，例如获取某个句子所涉及的所有行：\n```python\nfor sent in doc.sentences:\n    # 获取与该句子有重叠的所有行\n    for row in sent.rows: \n        print([token.text for token in row.tokens])\n```\n\n### 4. 保存与加载文档\n解析后的文档可以序列化为 JSON 以便后续使用或增量处理。\n\n**保存文档：**\n```python\nimport json\n\nwith open('output_doc.json', 'w') as f_out:\n    json.dump(doc.to_json(), f_out, indent=4)\n```\n\n**加载文档：**\n```python\nfrom papermage import Document\nimport json\n\nwith open('output_doc.json') as f_in:\n    doc_dict = json.load(f_in)\n    doc = Document.from_json(doc_dict)\n```","某自然语言处理研究员 Lucy 正在构建一个科学文献问答系统，需要从海量 PDF 论文中精准提取带位置信息的段落和公式数据。\n\n### 没有 papermage 时\n- **结构解析困难**：传统工具只能提取纯文本，无法区分页眉、脚注、正文或章节标题，导致训练数据充满噪声。\n- **空间关系丢失**：难以判断某个句子具体位于哪一页的哪一行，更无法获取该句子与附近表格或图片的空间交叉关系。\n- **多模态对齐繁琐**：若要关联文本与图表，需手动编写复杂的坐标计算逻辑来匹配视觉元素，开发周期长达数周。\n- **层级访问僵化**：不同粒度（如词、句、段）的数据相互隔离，无法动态查询“某段落包含的所有令牌”或“某行所属的句子”。\n\n### 使用 papermage 后\n- **智能分层提取**：papermage 自动将文档解析为包含标题、摘要、参考文献等 20 多种语义层的结构化对象，直接获得干净数据。\n- **动态空间索引**：利用其动态构建的实体索引，可一键查询任意句子所在的行、页码，甚至精确找出与该句子有重叠区域的图片。\n- **多模态原生支持**：通过统一的 `Document` 对象，轻松遍历“页面 - 句子 - 行 - 令牌”的嵌套关系，瞬间完成文本与视觉元素的逻辑对齐。\n- **灵活交叉查询**：支持跨层级自由访问（如 `sent.rows` 或 `page.sentences`），无需重复解析即可按需组合不同粒度的特征。\n\npapermage 通过将非结构化 PDF 转化为富含空间语义的统一对象模型，让科研团队从繁琐的清洗工作中解放，专注于核心算法创新。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fallenai_papermage_c057397d.png","allenai","Ai2","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fallenai_65c450d5.png","",null,"ai2-info@allenai.org","http:\u002F\u002Fwww.allenai.org","https:\u002F\u002Fgithub.com\u002Fallenai",[84,88],{"name":85,"color":86,"percentage":87},"Python","#3572A5",99.6,{"name":89,"color":90,"percentage":91},"Shell","#89e051",0.4,792,64,"2026-04-03T03:51:33","Apache-2.0","Linux, macOS","未说明",{"notes":99,"python":100,"dependencies":101},"该项目为 EMNLP 2023 的研究原型，目前不再定期维护或修复问题。相关功能已迁移至 Dolma 项目。macOS 用户必须通过 conda 安装 poppler 库以支持 PDF 渲染。开发环境需安装 dev、predictors 和 visualizers 额外组件。","3.11",[102,103,104,105],"poppler (macOS required)","pdfplumber","pdf2image","pytest",[13,26,54,14],[108,109,110,111,112,113,114],"computer-vision","machine-learning","multimodal","natural-language-processing","pdf-processing","scientific-papers","python","2026-03-27T02:49:30.150509","2026-04-06T07:11:59.763260",[118,123,128,133,138,143],{"id":119,"question_zh":120,"answer_zh":121,"source_url":122},17683,"如何从 PDF 中提取图表（Figures）？","可以使用 `CoreRecipe` 加载文档，然后通过页面交集获取图表实体。具体代码如下：\n\n```python\nfrom papermage.magelib import Document\nfrom papermage.recipes import CoreRecipe\nfrom papermage.visualizers.visualizer import plot_entities_on_page\nimport pathlib\n\n# 加载文档\nrecipe = CoreRecipe()\npdfpath = pathlib.Path(\"path\u002Fto\u002Fyour.pdf\")\ndoc = recipe.from_pdf(pdf=pdfpath)\n\n# 获取指定页面的图表（例如第 0 页）\npage_id = 0\nfigures = doc.pages[page_id].intersect_by_box(\"figures\")\n\n# 可视化验证（可选）\nplot_entities_on_page(page_image=doc.images[page_id], entities=figures)\n```\n注意：`doc.figures` 直接访问可能无法返回数据，需通过页面层级提取。","https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fissues\u002F70",{"id":124,"question_zh":125,"answer_zh":126,"source_url":127},17684,"提取到的图表只有边界框坐标，如何获取实际的图表图像裁剪？","图表默认以边界框形式存储。若需获取实际图像裁剪，需结合页面图像尺寸将相对坐标转换为绝对坐标，然后使用 PIL 进行裁剪。代码如下：\n\n```python\n# 获取页面图像及其尺寸\npage_image = doc.images[page_id]\npage_w, page_h = page_image.pilimage.size\n\n# 获取第一个图表的边界框\nfigure_box = figures[0].boxes[0]\n\n# 转换为绝对坐标\nfigure_box_xy = figure_box.to_absolute(page_width=page_w, page_height=page_h).xy_coordinates\n\n# 使用 PIL 裁剪图像\ncropped_figure = page_image._pilimage.crop(figure_box_xy)\n```","https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fissues\u002F63",{"id":129,"question_zh":130,"answer_zh":131,"source_url":132},17685,"运行 `pip install -e '.[dev,predictors,visualizers]'` 时报错提示不是有效的可编辑要求怎么办？","这通常与 Shell 环境有关。在 `zsh` 中安装时，单引号是必须的；而在 `bash` 中可能不需要。请确保使用 `pip install` 而不是 `python install`。\n\n尝试以下命令：\n```bash\npip install -e '.[dev,predictors,visualizers]'\n```\n如果是在 `bash` 中仍然报错，可以尝试去掉单引号：\n```bash\npip install -e .[dev,predictors,visualizers]\n```","https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fissues\u002F57",{"id":134,"question_zh":135,"answer_zh":136,"source_url":137},17686,"导入 `CoreRecipe` 时出现 `ModuleNotFoundError: No module named 'decontext'` 错误如何解决？","这是由于 PyPI 上的版本未及时更新导致的依赖缺失问题。请确保安装最新版本（至少 0.15.0）。\n\n解决方法：\n1. 创建一个新的虚拟环境。\n2. 运行以下命令安装包含所有可选依赖的版本：\n```bash\npip install 'papermage[dev,predictors,visualizers]'\n```\n3. 验证版本：\n```bash\npip list | grep papermage\n# 应显示 papermage == 0.15.0 或更高\n```\n4. 再次尝试导入：\n```python\nfrom papermage.recipes import CoreRecipe\n```","https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fissues\u002F67",{"id":139,"question_zh":140,"answer_zh":141,"source_url":142},17687,"论文中提到的代码示例（如 `pm.PDF2TextParser()`）在当前版本中无法运行怎么办？","论文中的代码示例可能与当前最新版本的 API 不一致，因为代码会随着时间推移而演进。请以 GitHub 仓库中的最新文档和示例为准。\n\n例如，论文中提到的 `PDF2TextParser` 已被弃用或重构。建议参考官方 README 或示例脚本获取最新的正确用法，不要直接复制论文中的代码片段。","https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fissues\u002F66",{"id":144,"question_zh":145,"answer_zh":146,"source_url":147},17688,"如何在顶层直接导入核心类型（如 `Entity`）？","目前该功能已实现。你可以直接从 `papermage` 包顶层导入核心类型，无需深入子模块。例如：\n\n```python\nfrom papermage import Entity\n```\n这简化了导入路径，使代码更简洁。","https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fissues\u002F14",[149,154,159],{"id":150,"version":151,"summary_zh":152,"released_at":153},107986,"v0.18.0","## 变更内容\n\n总的来说，最大的变化是对 `magelib` 中的一些 bug 行为进行了清理，特别是在 `layers` 和 `entities` 以及它们在交叉引用时的处理方式上，尤其是在 `entities` 缺少某些字段（如 `spans`）的情况下。\n\n* 格式化并更新 decontext，由 @bnewm0609 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F37 中完成\n* 为训练器添加验证功能，由 @bnewm0609 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F20 中完成\n* 升级到 Python 3.11，由 @bnewm0609 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F10 中完成\n* 添加文本配方；清理核心配方；移除不必要的 Field 依赖……，由 @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F46 中完成\n* 去重两个相同合并函数的实现；添加测试，由 @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F47 中完成\n* Kylel\u002F清理预测器，由 @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F48 中完成\n* Kylel\u002Flayers，由 @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F50 中完成\n* 添加 slots，由 @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F51 中完成\n* 重命名 layer 相关内容，由 @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F53 中完成\n* 更新 push_to_pypi.sh 脚本，由 @eltociear 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F58 中完成\n* 更新 README，由 @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F68 中完成\n* 移除对 Pandas 版本的限制，由 @mdr223 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F71 中完成\n* Bug 修复！图表缺失？，由 @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F73 中完成\n* 使 Entity.layers 更加智能：检查 spans 和 boxes 是否同时存在于两个图层上，由 @josephcc 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F74 中完成\n\n## 新贡献者\n* @eltociear 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F58 中完成了首次贡献\n* @mdr223 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F71 中完成了首次贡献\n* @josephcc 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F74 中完成了首次贡献\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fcompare\u002Fv0.11.1...v0.18.0","2024-03-17T22:35:15",{"id":155,"version":156,"summary_zh":157,"released_at":158},107987,"v0.11.1","## 变更内容\n* @bnewm0609 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F6 中添加了使用 Hugging Face 预测器进行训练和推理的代码\n* @kyleclo 的 2023 年 8 月版 layoutparser，由 @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F11 中实现\n* @bnewm0609 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F15 中实现了跨度问答预测器\n* @bnewm0609 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F17 中添加了 LP 预测器\n* @bnewm0609 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F18 中添加了配方\n* @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F19 中重新组织了文件结构\n* @amanpreet692 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F21 和 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F22 中为 PaperMage 添加了 Grobid 解析器\n* @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F23 中实现了 Kylel\u002F2023\u002F框查询\n* @soldni 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F26 中进行了小幅更新\n* @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F27 中实现了 Kylel\u002F2023\u002F框查询文档\n* @soldni 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F28 中再次进行了小幅更新\n* @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F30 中添加了 i-vila 示例\n* @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F31 中添加了 WS 预测器\n* @soldni 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F33 中进行了小幅更新\n* @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F32 中添加了单词预测器\n* @bnewm0609 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F34 中将证据作为独立标注返回\n* @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F35 中实现了句子预测\n* @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F36 中添加了测试用例\n* @soldni 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F25 中添加了测试\n* @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F38 中实现了 Kylel\u002F2023\u002F封装\n* @soldni 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F40 中进行了小幅更新\n* @soldni 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F39 中修复了 Grobid 评估中的问题\n* @kyleclo 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F41 中修复了一个小错误\n* @soldni 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F42 中在配方中添加了 VILA 分段信息\n* @soldni 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F43 中提供了演示\n\n## 新贡献者\n* @amanpreet692 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F21 中做出了首次贡献\n* @soldni 在 https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fpull\u002F26 中做出了首次贡献\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fallenai\u002Fpapermage\u002Fcompare\u002Fv0.0.1...v0.11.1","2023-08-07T17:30:27",{"id":160,"version":161,"summary_zh":162,"released_at":163},107988,"v0.0.1","- 定义核心数据类型，如 `Document` 和 `Entity`  - 添加 `PDFPlumberParser`  - 添加 `PDF2ImageRasterizer`","2023-07-21T06:13:25"]