ワンクリックで
reaction-data-extraction
从 PDF 文献中提取化学反应数据,特别是反应条件优化信息。支持提取反应物、产物、催化剂、溶剂、温度、时间、产率等,并输出结构化 CSV 文件。使用 MinerU + NLP + 规则匹配进行精确提取。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
从 PDF 文献中提取化学反应数据,特别是反应条件优化信息。支持提取反应物、产物、催化剂、溶剂、温度、时间、产率等,并输出结构化 CSV 文件。使用 MinerU + NLP + 规则匹配进行精确提取。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Extract structured chemical compound characterization data from chemistry supplementary material documents (PDF/Markdown). 从化学论文补充材料(PDF/Markdown)中提取结构化化合物表征数据。 Use when Kimi needs to extract compound properties including NMR spectra, HRMS, HPLC data, melting points, optical rotation, and yield information from chemistry research papers or supplementary materials. 支持提取NMR谱图、HRMS、HPLC数据、熔点、旋光度、产率等信息。 Supports both single compound extraction and batch extraction of all compounds. 支持单个化合物提取和批量提取所有化合物。
Convert Gaussian gjf input files to XYZ format. 将Gaussian gjf输入文件转换为XYZ格式。 Use when agent needs to convert molecular structure files from Gaussian input format (.gjf) to XYZ format for visualization or use with other computational chemistry software. 当智能体需要将Gaussian输入格式(.gjf)的分子结构文件转换为XYZ格式用于可视化或其他计算化学软件时使用。
Convert PDF files to Markdown using MinerU API. 使用MinerU API将PDF文件转换为Markdown格式。 Use when Kimi needs to extract structured text, images, tables, and formulas from PDF documents while preserving document layout and formatting. 适用于需要提取结构化文本、图片、表格和公式并保留文档布局的场景。 Supports batch conversion and outputs full.md with images/, JSON metadata, and other extracted assets. 支持批量转换,输出full.md、images/目录、JSON元数据等。 Now supports large PDFs (600+ pages) by automatic splitting and merging. 现已支持大文件(600+页)自动拆分和合并处理。
Extract DFT calculation coordinates from PDF files and generate Gaussian gjf files. 从PDF文件中提取DFT计算坐标并生成Gaussian gjf输入文件。 Supports batch processing with separate output folders for each PDF. 支持批量处理,每个PDF单独生成输出文件夹。
Predict and visualize MS/MS spectra from a single SMILES using the fioRa online app. Use when the user wants a mass spectrum, MGF/MSP output, or a plotted stick spectrum from SMILES, with optional custom Name, precursor type, collision energy, and instrument settings.
Predict liquid-phase ¹H and ¹³C NMR chemical shifts from a SMILES string using NMRNet (deep learning, SE(3)-Transformer). Outputs per-atom shift values (ppm) and Lorentzian-broadened spectrum PNG files.
| name | reaction-data-extraction |
| description | 从 PDF 文献中提取化学反应数据,特别是反应条件优化信息。支持提取反应物、产物、催化剂、溶剂、温度、时间、产率等,并输出结构化 CSV 文件。使用 MinerU + NLP + 规则匹配进行精确提取。 |
| trigger | ["反应数据提取","提取反应条件","reaction extraction","extract reaction conditions","从文献提取反应","反应优化数据","reaction optimization","提取产率","extract yield","反应表格","reaction table"] |
从化学文献 PDF 中精确提取化学反应数据,特别是反应条件优化信息。支持提取反应物、产物、催化剂、溶剂、温度、时间、产率等关键信息,并输出结构化的 CSV/JSON 文件。
| 组件 | 用途 |
|---|---|
| MinerU | PDF 解析和文本提取 (命令行调用) |
| 正则表达式 | 反应条件模式匹配 |
| 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 偶联反应的条件
# 基本提取(自动模式)
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/json | csv |
--method | -m | MinerU 解析方法:auto/txt/ocr | auto |
--lang | -l | OCR 语言 | en |
--device | -d | 设备:cpu/cuda | cpu |
--verbose | -v | 详细输出 | false |
--batch | -b | 批量处理模式 | false |
$ 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
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
{
"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
}
]
}
# 安装 MinerU(命令行工具)
pip install 'mineru[all]'
# 如果遇到 numpy 版本问题
pip install 'numpy<2.0' 'pandas<3.0'
# 检查安装
mineru --version
# 检查 MinerU 命令行工具
mineru --help
# 测试 PDF 解析
mineru -p test.pdf -o ./test_output -m txt
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)
import re
# 从 Markdown 中提取表格
table_pattern = r'\|.*?\|.*?\|.*?\n\|[-\| ]+\|\n((?:\|.*?\|\n)+)'
tables = re.findall(table_pattern, text_content, re.MULTILINE)
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
# 反应条件模式
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-Miyaura | Suzuki, boronic acid, Pd catalyst |
| Heck | Heck, alkene, Pd catalyst |
| Sonogashira | Sonogashira, alkyne, Cu co-catalyst |
| Buchwald-Hartwig | Buchwald, amination, Pd catalyst |
| Oxidative amination | oxidative, amination, oxidant |
| Click | Click, azide, alkyne, CuAAC |
| Diels-Alder | Diels-Alder, diene, dienophile |
| Aldol | Aldol, enolate, carbonyl |
| Oxidation | Oxidation, oxidant |
| Reduction | Reduction, reductant, hydrogenation |
# 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
# 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"
# 提取所有反应数据
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
# 批量处理整个目录
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
# 提取并过滤高产率条件
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
--method ocr| 错误 | 说明 | 解决方案 |
|---|---|---|
No tables found | 未检测到表格 | 使用 --text-only 提取体内容反应 |
MinerU execution failed | MinerU 执行失败 | 检查 mineru 是否正确安装 |
Timeout | 处理超时(>10 分钟) | 尝试 -m txt 模式或减小文件 |
Low confidence | 提取置信度低 | 检查原文,手动校正 |
File not found | PDF 文件不存在 | 检查文件路径 |
| 文档类型 | 页数 | 处理时间 | 提取反应数 |
|---|---|---|---|
| 短篇通信 | 4-6 | ~30s | 5-15 |
| 完整论文 | 10-15 | ~1-2min | 20-50 |
| 综述文章 | 20-30 | ~3-5min | 50-100+ |
| 支持信息 | 50-100 | ~5-10min | 100-200+ |
重要:为了能在飞书等平台上发送生成的文件,输出目录必须在白名单内:
~/.openclaw/media/reaction-data-extraction/~/.openclaw/workspace/~/.openclaw/agents/本 skill 默认输出到 ~/.openclaw/media/reaction-data-extraction/,可以直接分享!
A:
A:
A:
mineru 命令可用:mineru --helppip install -U 'mineru[all]'A:
MinerU 是 opendatalab 开源的工业级 PDF 解析工具:
本技能使用命令行调用MinerU,而不是 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 | 需要人工核对 |
核心技术:
引用:
@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}
}