Reaction Data Extraction logo

Reaction Data Extraction

Organization
InternScience
reaction-data-extraction

从 PDF 文献中提取化学反应数据,特别是反应条件优化信息。支持提取反应物、产物、催化剂、溶剂、温度、时间、产率等,并输出结构化 CSV 文件。使用 MinerU + NLP + 规则匹配进行精确提取。

Overview

PublisherInternScience
RepositoryChemClaw
Skill namereaction-data-extraction
Stars
53
Forks
13
Bundled files
4
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.

  • 4 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 Reaction Data Extraction 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/reaction-data-extraction
  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/reaction-data-extraction .claude/skills/reaction-data-extraction
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Reaction Data Extraction 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 Reaction Data Extraction 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 Reaction Data Extraction 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.

Reaction Data Extraction

从化学文献 PDF 中精确提取化学反应数据,特别是反应条件优化信息。支持提取反应物、产物、催化剂、溶剂、温度、时间、产率等关键信息,并输出结构化的 CSV/JSON 文件。

触发条件

  • 用户提供 PDF 文献并要求提取反应数据
  • 提到"提取反应条件"、"反应优化数据"
  • 说"extract reaction conditions"、"reaction data from PDF"
  • 需要从文献中整理反应表格
  • 需要批量提取多篇文献的反应数据

功能特性

  • ✅ 反应物/产物识别 - 自动提取反应物和产物的 SMILES/名称
  • ✅ 反应条件提取 - 催化剂、配体、溶剂、添加剂
  • ✅ 参数提取 - 温度、时间、压力、浓度
  • ✅ 产率提取 - 分离产率、GC 产率、NMR 产率
  • ✅ 反应类型识别 - 偶联、氧化、还原、环化等
  • ✅ 表格数据提取 - 从反应条件优化表格中提取数据
  • ✅ 支持体内容 - 从正文段落中提取反应描述
  • ✅ 结构化输出 - CSV/JSON 格式,便于后续分析
  • ✅ 批量处理 - 支持多篇文献批量提取
  • ✅ 置信度评分 - 每个提取结果附带置信度

核心技术

组件用途
MinerUPDF 解析和文本提取 (命令行调用)
正则表达式反应条件模式匹配
Rule-based Parser反应句子解析
表格解析器Markdown 表格→反应数据

提取的数据字段

字段说明示例
reaction_id反应唯一标识RXN_001
entry表格中的条目号1, 2, 3
reactants反应物 (SMILES 或名称)c1ccccc1Br
products产物 (SMILES 或名称)c1ccccc1-c2ccccc2
catalyst催化剂Pd(PPh3)4
ligand配体PPh3
base碱K2CO3
solvent溶剂DMF, Toluene
temperature温度80 °C, rt, reflux
time反应时间12 h, 30 min
pressure压力 (如有)1 atm, 10 bar
concentration浓度0.1 M
yield_value产率数值85
yield_type产率类型isolated, GC, NMR
ee_value对映选择性99%, >99%
reaction_type反应类型Suzuki coupling
scheme_number反应式编号Scheme 1, Table 2
page_number页码5
confidence提取置信度0.95
notes备注optimized condition

使用方法

对话框中使用

从这篇 PDF 提取所有反应条件
提取反应优化数据并生成 CSV
extract reaction data from this paper
把文献中的反应表格整理成 Excel
提取 Suzuki 偶联反应的条件

命令行使用

bash
# 基本提取(自动模式)
python3 scripts/reaction_data_extraction.py -i paper.pdf -o ./output

# 只提取表格数据
python3 scripts/reaction_data_extraction.py -i paper.pdf -o ./output --tables-only

# 只提取体内容反应
python3 scripts/reaction_data_extraction.py -i paper.pdf -o ./output --text-only

# 批量处理
python3 scripts/reaction_data_extraction.py -i ./papers/ -o ./output --batch

# JSON 输出
python3 scripts/reaction_data_extraction.py -i paper.pdf -o ./output --output-format json

# 详细模式
python3 scripts/reaction_data_extraction.py -i paper.pdf -o ./output -v

# 使用 OCR 处理扫描版
python3 scripts/reaction_data_extraction.py -i scanned.pdf -o ./output --method ocr

参数说明

参数简写说明默认值
--input-i输入 PDF 文件或目录-
--output-o输出目录~/.openclaw/media/reaction-data-extraction
--tables-only-t只提取表格数据false
--text-only--text只提取体内容反应false
--output-format-f输出格式:csv/jsoncsv
--method-mMinerU 解析方法:auto/txt/ocrauto
--lang-lOCR 语言en
--device-d设备:cpu/cudacpu
--verbose-v详细输出false
--batch-b批量处理模式false

输出示例

基本提取

bash
$ python3 scripts/reaction_data_extraction.py -i organic_paper.pdf -o ./output -v
✓ 输出目录:/home/lla/.openclaw/media/reaction-data-extraction/output
  提取模式:all
  输出格式:csv

✓ 开始处理:organic_paper.pdf
  [1/3] 解析 PDF...
    命令:mineru -p organic_paper.pdf -o ./output -m auto -l en --backend pipeline -d cpu
    ✓ PDF 解析完成,文本长度:41804 字符
    检测到表格:3 个
  [2/3] 从表格提取反应数据...
    提取表格反应:25
  [3/3] 从文本提取反应数据...
    从文本提取:18 个反应

✓ 已处理:organic_paper.pdf
  提取反应数:43
  ✓ CSV 已保存:./output/organic_paper/reaction_data.csv
  ✓ 日志已保存:./output/organic_paper/extraction_log.txt

============================================================
✅ 全部完成!
   输出目录:/home/lla/.openclaw/media/reaction-data-extraction/output

CSV 输出示例

csv
reaction_id,entry,catalyst,ligand,solvent,temperature,time,yield_value,ee_value,reaction_type,source,confidence
RXN_001,1,Pd₂(dba)₃,L7,MeOH,40 °C,24 h,99,99%,asymmetric oxidative allylic amination,table_0,0.9
RXN_002,2,Pd(OAc)₂,L7,MeOH,40 °C,24 h,trace,,asymmetric oxidative allylic amination,table_0,0.9
RXN_003,3,Pd(dba)₂,L7,MeOH,40 °C,24 h,97,99%,asymmetric oxidative allylic amination,table_0,0.9

JSON 输出示例

json
{
  "extraction_date": "2026-03-17T22:04:38",
  "total_reactions": 43,
  "reactions": [
    {
      "reaction_id": "RXN_001",
      "entry": 1,
      "catalyst": "Pd₂(dba)₃",
      "ligand": "L7",
      "solvent": "MeOH",
      "temperature": "40 °C",
      "time": "24 h",
      "yield_value": 99,
      "ee_value": "99%",
      "source": "table_0",
      "confidence": 0.9
    }
  ]
}

依赖安装

bash
# 安装 MinerU(命令行工具)
pip install 'mineru[all]'

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

# 检查安装
mineru --version

检查安装

bash
# 检查 MinerU 命令行工具
mineru --help

# 测试 PDF 解析
mineru -p test.pdf -o ./test_output -m txt

工作流程

1. PDF 解析(使用 MinerU 命令行)

python
import subprocess

# 运行 MinerU
cmd = [
    "mineru",
    "-p", "paper.pdf",
    "-o", "./output",
    "-m", "auto",
    "-l", "en",
    "--backend", "pipeline",
    "-d", "cpu"
]

result = subprocess.run(cmd, capture_output=True, text=True, timeout=600)

2. 表格检测与提取

python
import re

# 从 Markdown 中提取表格
table_pattern = r'\|.*?\|.*?\|.*?\n\|[-\| ]+\|\n((?:\|.*?\|\n)+)'
tables = re.findall(table_pattern, text_content, re.MULTILINE)

3. 反应数据解析

python
def parse_reaction_table(table_text):
    lines = table_text.strip().split('\n')
    headers = [h.strip() for h in lines[0].split('|') if h.strip()]
    
    reactions = []
    for line in lines[2:]:
        values = [v.strip() for v in line.split('|') if v.strip()]
        reaction = dict(zip(headers, values))
        reactions.append(reaction)
    
    return reactions

4. 文本数据提取

python
# 反应条件模式
patterns = {
    'temperature': r'(\d+\s*°C|rt|reflux)',
    'time': r'(\d+\s*(h|hr|hour|min)s?)',
    'yield': r'(\d+\s*%)',
    'catalyst': r'(Pd\([^)]+\)|Pd₂\(dba\)₃)',
}

for key, pattern in patterns.items():
    match = re.search(pattern, sentence, re.IGNORECASE)
    if match:
        reaction[key] = match.group(1)

反应类型识别

支持识别的反应类型:

反应类型关键词
Suzuki-MiyauraSuzuki, boronic acid, Pd catalyst
HeckHeck, alkene, Pd catalyst
SonogashiraSonogashira, alkyne, Cu co-catalyst
Buchwald-HartwigBuchwald, amination, Pd catalyst
Oxidative aminationoxidative, amination, oxidant
ClickClick, azide, alkyne, CuAAC
Diels-AlderDiels-Alder, diene, dienophile
AldolAldol, enolate, carbonyl
OxidationOxidation, oxidant
ReductionReduction, reductant, hydrogenation

与其他技能配合

与 literature-parsing 配合

bash
# 1. 先解析 PDF 为 Markdown
python3 ../literature-parsing/scripts/literature_parsing.py -i paper.pdf -o ./parsed

# 2. 从 Markdown 提取反应数据
python3 scripts/reaction_data_extraction.py -i ./parsed/paper.md -o ./output

与 yields-prediction 配合

bash
# 1. 提取实验产率数据
python3 scripts/reaction_data_extraction.py -i paper.pdf -o ./output

# 2. 使用 ML 模型预测相同反应的产率
python3 ../yields-prediction/scripts/yields_predictor.py \
  --reactants "reactant_smiles" \
  --products "product_smiles"

完整工作流程示例

示例 1: 单篇文献提取

bash
# 提取所有反应数据
python3 scripts/reaction_data_extraction.py \
  -i jacs_paper.pdf \
  -o ./output/jacs_data \
  --output-format csv \
  -v

# 查看结果
cat ./output/jacs_data/reaction_data.csv

示例 2: 批量提取

bash
# 批量处理整个目录
python3 scripts/reaction_data_extraction.py \
  -i ./papers/ \
  -o ./output/all_reactions \
  --batch

# 合并所有数据
python3 scripts/merge_reactions.py \
  -i ./output/all_reactions/ \
  -o ./output/combined_reactions.csv

示例 3: 只提取最优条件

bash
# 提取并过滤高产率条件
python3 scripts/reaction_data_extraction.py \
  -i paper.pdf \
  -o ./output \
  --output-format json

# 后处理:筛选最优条件
python3 scripts/filter_optimal.py \
  -i ./output/reaction_data.json \
  --min-yield 80 \
  -o ./output/optimal_conditions.csv

注意事项

  • ✅ 高准确率 - 表格数据提取准确率 >90%
  • ✅ 支持多种格式 - CSV/JSON 输出
  • ✅ 置信度评分 - 每个结果附带置信度
  • ✅ MinerU 命令行 - 使用 subprocess 调用,避免库导入问题
  • ⚠️ PDF 质量 - 扫描版 PDF 需要使用 --method ocr
  • ⚠️ 复杂表格 - 跨页表格可能需要手动校正
  • ⚠️ 隐式条件 - 某些条件可能在正文中描述而非表格
  • ⚠️ 处理时间 - 长文献可能需要几分钟

错误处理

错误说明解决方案
No tables found未检测到表格使用 --text-only 提取体内容反应
MinerU execution failedMinerU 执行失败检查 mineru 是否正确安装
Timeout处理超时(>10 分钟)尝试 -m txt 模式或减小文件
Low confidence提取置信度低检查原文,手动校正
File not foundPDF 文件不存在检查文件路径

性能参考

文档类型页数处理时间提取反应数
短篇通信4-6~30s5-15
完整论文10-15~1-2min20-50
综述文章20-30~3-5min50-100+
支持信息50-100~5-10min100-200+

输出目录白名单

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

  • ✅ ~/.openclaw/media/reaction-data-extraction/
  • ✅ ~/.openclaw/workspace/
  • ✅ ~/.openclaw/agents/

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

常见问题

Q: 提取的产率数据不准确怎么办?

A:

  • 检查原文中产率的表示方式(isolated/GC/NMR)
  • 某些表格可能使用 footnote 说明
  • 手动校正后更新 CSV

Q: 如何处理支持信息 (Supporting Information)?

A:

  • SI 通常包含更多反应数据
  • 使用相同流程处理 SI PDF
  • 合并主文和 SI 的数据

Q: MinerU 导入失败怎么办?

A:

  • 本技能使用 MinerU 命令行工具,不依赖 Python 库导入
  • 确保 mineru 命令可用:mineru --help
  • 如果不行,重新安装:pip install -U 'mineru[all]'

Q: 如何验证提取结果的准确性?

A:

  • 检查 confidence 字段(>0.8 较可靠)
  • 随机抽样人工核对
  • 与原文表格对比

技术细节

MinerU 优势

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

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

命令行调用 vs Python 库

本技能使用命令行调用MinerU,而不是 Python 库导入:

python
# ✅ 推荐:命令行调用
subprocess.run(["mineru", "-p", "paper.pdf", "-o", "./output"])

# ❌ 避免:Python 库导入(可能有版本兼容问题)
from mineru.backend import Pipeline

优势:

  • 避免版本兼容性问题
  • 更稳定的执行环境
  • 易于调试和错误处理

置信度评分

来源置信度说明
表格数据0.9-0.95结构化数据,准确率高
体内容明确描述0.7-0.8清晰的反应描述
体内容模糊描述0.3-0.5需要人工核对

引用

核心技术:

引用:

bibtex
@article{swain2016chemdataextractor,
  title={ChemDataExtractor: a toolkit for automated extraction of chemical information from the scientific literature},
  author={Swain, Matthew C and Cole, Jacqueline M},
  journal={Journal of Chemical Information and Modeling},
  year={2016}
}

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 Reaction Data Extraction AI skill do?

从 PDF 文献中提取化学反应数据,特别是反应条件优化信息。支持提取反应物、产物、催化剂、溶剂、温度、时间、产率等,并输出结构化 CSV 文件。使用 MinerU + NLP + 规则匹配进行精确提取。

Why use Reaction Data Extraction on TypingMind?

Because you install it once and use it with any model. Reaction Data Extraction 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 Reaction Data Extraction in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/InternScience/ChemClaw/tree/main/skills/reaction-data-extraction. 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 Reaction Data Extraction?

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 Reaction Data Extraction?

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

Is the Reaction Data Extraction 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 👇