Literature Parsing logo

Literature Parsing

Organization
InternScience
literature-parsing

将 PDF 文献转换为 Markdown 文件,并提取所有图表图片。使用 MinerU (opendatalab) 进行工业级高质量解析。

Overview

PublisherInternScience
RepositoryChemClaw
Skill nameliterature-parsing
Stars
53
Forks
13
Bundled files
2
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by InternScience on GitHub. Read the source before you install it.

Installation

Install the Literature Parsing AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/InternScience/ChemClaw/tree/main/skills/literature-parsing
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/InternScience/ChemClaw.git /tmp/ChemClaw
mkdir -p .claude/skills
cp -r /tmp/ChemClaw/skills/literature-parsing .claude/skills/literature-parsing
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Literature Parsing in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Literature Parsing on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Literature Parsing is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Literature Parsing Skill

将 PDF 文献完整转换为 Markdown 文件,并自动提取所有图表和图片。使用 MinerU (opendatalab) 进行工业级高质量解析。

触发条件

  • 用户提供 PDF 文件并要求转换为 Markdown
  • 提到"PDF 转 Markdown"、"文献解析"
  • 说"提取 PDF 中的图片"、"extract figures from PDF"
  • 需要批量处理多个 PDF 文件

功能特性

  • ✅ PDF → Markdown 转换 - 保留标题、段落、列表、公式等结构
  • ✅ 智能空格处理 - 自动修复中英文之间的空格
  • ✅ 图表提取 - 提取 PDF 中嵌入的真实图片
  • ✅ 表格识别 - 检测并转换表格为 Markdown 格式
  • ✅ 公式保留 - LaTeX 格式数学公式
  • ✅ 元数据提取 - 提取标题、作者等信息
  • ✅ 批量处理 - 支持同时处理多个 PDF
  • ✅ 结构化输出 - 生成组织良好的 Markdown 文档

核心技术

组件用途
MinerU工业级 PDF 解析引擎 (opendatalab)
Pipeline Backend文本提取、布局分析
OCR扫描版 PDF 文字识别

输出结构

转换后的目录结构:

output_folder/
├── document.md          # 主 Markdown 文件
├── images/              # 提取的图片
│   ├── xxx.jpg
│   ├── yyy.jpg
│   └── ...
└── document_metadata.json  # 文档元数据

使用方法

对话框中使用

将这个 PDF 转换为 Markdown
解析这篇文献,提取所有图片
PDF to Markdown with figures
批量转换这些 PDF 文件

命令行使用

bash
# 基本转换(自动模式)
python3 scripts/literature_parsing.py -i paper.pdf -o ./output

# 文本 PDF(速度快)
python3 scripts/literature_parsing.py -i paper.pdf -o ./output -m txt

# 扫描版 PDF(使用 OCR)
python3 scripts/literature_parsing.py -i paper.pdf -o ./output -m ocr

# 指定语言(提高 OCR 准确率)
python3 scripts/literature_parsing.py -i paper.pdf -o ./output -l en

# 使用 GPU 加速
python3 scripts/literature_parsing.py -i paper.pdf -o ./output -d cuda

直接使用 MinerU

bash
# 基本用法
mineru -p paper.pdf -o ./output

# 文本模式(无图片,速度快)
mineru -p paper.pdf -o ./output -m txt

# OCR 模式(扫描版)
mineru -p paper.pdf -o ./output -m ocr

# 指定语言
mineru -p paper.pdf -o ./output -l ch

# 指定设备
mineru -p paper.pdf -o ./output --device cpu

参数说明

参数简写说明默认值
--input-i输入 PDF 文件路径-
--output-o输出目录~/.openclaw/media/literature-parsing
--method-m解析方法:auto/txt/ocrauto
--lang-lOCR 语言:ch/en 等ch
--device-d设备:cpu/cudacpu
--quiet-q安静模式(输出 JSON)false

输出示例

基本转换

bash
$ python3 scripts/literature_parsing.py -i paper.pdf -o ./output
✓ 开始处理:paper.pdf
  输出目录:./output
  解析方法:auto
  设备:cpu
✓ 处理完成:paper.pdf
  Markdown: paper.md
  图片数量:12 张
✓ 文件已整理到:./output/paper

✅ 转换完成!
📄 Markdown: ./output/paper/paper.md
🖼️  图片:./output/paper/images (12 张)
📊 元数据:./output/paper/paper_metadata.json

批量处理

bash
# 处理目录中所有 PDF
for pdf in *.pdf; do
  python3 scripts/literature_parsing.py -i "$pdf" -o ./output
done

Markdown 输出格式

生成的 Markdown 文件结构:

markdown
# 论文标题

作者信息

# Abstract

摘要内容...

# 1. Introduction

正文内容,保留 LaTeX 公式:$E = mc^2$

![Figure 1](images/xxx.jpg)

## 2. Methods

### 2.1 Data Collection

| Column 1 | Column 2 |
|----------|----------|
| Data A   | Data B   |

![Figure 2](images/yyy.jpg)

# References

[1] Author A, et al. Title. Journal, 2023.

依赖安装

bash
# 安装 MinerU
pip install 'mineru[all]'

# 如果遇到 numpy 版本问题
pip install 'numpy<2.0' 'pandas<3.0'

特性说明

文本提取改进

  • ✅ 智能空格修复 - 自动在中英文之间添加空格
  • ✅ 保留布局 - 使用先进的布局分析
  • ✅ 段落识别 - 自动检测段落边界
  • ✅ 标题检测 - 识别标题层级

图片提取改进

  • ✅ 嵌入图片提取 - 提取真实嵌入的图片
  • ✅ 格式保留 - 保持原始图片格式(JPG/PNG)
  • ✅ 按哈希命名 - 自动去重

公式处理

  • ✅ LaTeX 保留 - 内联公式 $...$ 和显示公式 $$...$$
  • ✅ 数学符号 - 完整保留数学符号

表格处理

  • ✅ 自动检测 - 识别 PDF 中的表格
  • ✅ Markdown 转换 - 转换为标准 Markdown 表格

注意事项

  • ✅ 自动创建目录 - 输出目录不存在时自动创建
  • ✅ 图片去重 - 使用 MD5 哈希值自动去重
  • ✅ 错误处理 - 损坏的 PDF 会跳过并报告
  • ⚠️ 扫描版 PDF - 使用 -m ocr 模式
  • ⚠️ 加密 PDF - 需要先解密
  • ⚠️ 复杂布局 - 多栏复杂排版可能影响转换质量

错误处理

错误说明解决方案
File not foundPDF 文件不存在检查文件路径
Invalid PDFPDF 格式损坏尝试修复或重新下载
Permission denied无读取权限检查文件权限
No images found未找到图片PDF 可能使用矢量图形
Timeout处理超时(>10 分钟)尝试 -m txt 模式或减小文件

与其他技能配合

与 chemical_file_converter 配合

处理化学文献时,可以:

  1. literature-parsing: 提取 PDF 中的分子结构和反应式图片
  2. chemical_file_converter: 转换提取的化学结构文件格式

与 mol_paper_renderer 配合

生成高质量论文:

  1. mol_paper_renderer: 生成出版级分子图片
  2. literature-parsing: 将包含这些图片的 PDF 转换为 Markdown

完整工作流程示例

示例 1: 单篇文献转换

bash
# 转换单篇 PDF
python3 scripts/literature_parsing.py -i nature_paper.pdf -o ./papers/nature

# 查看结果
ls -la ./papers/nature/
# paper.md
# images/xxx.jpg ...
# paper_metadata.json

示例 2: 批量文献库处理

bash
# 批量转换
mkdir -p ~/papers/library
for pdf in ~/downloads/*.pdf; do
  python3 scripts/literature_parsing.py -i "$pdf" -o ~/papers/library
done

示例 3: 只处理特定页面

bash
# 使用 MinerU 直接处理
mineru -p paper.pdf -o ./output -s 0 -e 9  # 只处理前 10 页

性能优化

文本 PDF(无图片)

bash
# 使用 txt 模式,速度更快
python3 scripts/literature_parsing.py -i paper.pdf -o ./output -m txt

扫描版 PDF

bash
# 使用 OCR 模式
python3 scripts/literature_parsing.py -i scanned.pdf -o ./output -m ocr

# 指定语言提高准确率
python3 scripts/literature_parsing.py -i scanned.pdf -o ./output -m ocr -l en

CPU/GPU 选择

bash
# 使用 CPU(兼容性好)
python3 scripts/literature_parsing.py -i paper.pdf -o ./output -d cpu

# 使用 GPU(速度快,需要 CUDA)
python3 scripts/literature_parsing.py -i paper.pdf -o ./output -d cuda

输出目录白名单

重要:为了能在飞书等平台上发送生成的文件,输出目录必须在白名单内:

  • ✅ ~/.openclaw/media/
  • ✅ ~/.openclaw/workspace/
  • ✅ ~/.openclaw/agents/

本 skill 默认输出到 ~/.openclaw/media/literature-parsing/,可以直接分享!

技术细节

MinerU 优势

MinerU 是 opendatalab 开源的工业级 PDF 解析工具:

  • 📊 布局分析 - 准确识别标题、段落、表格、图片
  • 📐 公式识别 - 完整保留 LaTeX 数学公式
  • 🖼️ 图片提取 - 提取真实嵌入的图片
  • 📝 OCR 支持 - 支持扫描版 PDF
  • 🌍 多语言 - 支持 109 种语言 OCR

与之前版本对比

特性PyMuPDFMinerU
文本提取⭐⭐⭐⭐⭐⭐⭐⭐
公式保留❌✅
表格识别⭐⭐⭐⭐⭐⭐
布局分析⭐⭐⭐⭐⭐⭐⭐
OCR 支持❌✅
扫描版支持❌✅

处理流程

  1. 布局分析 - 识别页面布局、文本区域、图片区域
  2. 文本提取 - 从 PDF 中提取文本内容
  3. 公式识别 - 识别并保留 LaTeX 公式
  4. 表格识别 - 检测表格并转换为 Markdown
  5. 图片提取 - 提取嵌入的图片
  6. OCR(可选) - 对扫描版进行文字识别
  7. 格式整理 - 生成结构化的 Markdown 文档

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Literature Parsing AI skill do?

将 PDF 文献转换为 Markdown 文件,并提取所有图表图片。使用 MinerU (opendatalab) 进行工业级高质量解析。

Why use Literature Parsing on TypingMind?

Because you install it once and use it with any model. Literature Parsing is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Literature Parsing in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/InternScience/ChemClaw/tree/main/skills/literature-parsing. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Literature Parsing?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Literature Parsing?

As many as you like. As long as a model supports skills, you can use Literature Parsing with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Literature Parsing AI skill free?

Yes. It is published on GitHub by InternScience under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇