pdf parsing ---- pdf 文本解析
文章目录
参考
工具列表:
中文 PDF 抽取工具
- pdfact
- paddleocr
grobid
- 中文支持不好
pdf2docx
- 排版信息不好,乱序
chinese_science_paper_to_text
pdfplumber
- 测试,中文专利可以
pdf 转图片
pdftoppm
- poppler 套装组件
pyvips (libvips)
pypdfium2
- convert (imagemagick)
工具
poppler
pdftotext
mupdf
mu convert
layout-parser
OCRmyPDF
dit-document-layout-analysispdfplumber
- 可以抽取 text
- 不可以 OCR
pd3f
- Documentation | pd3f – PDF Text Extractor
功能:
- 纯文本抽取
- 表格抽取
依赖
OCRmyPDF
- tesseract
- unpaper
parsr
- tabula
- camolot
grobid
- GitHub - kermitt2/grobid: A machine learning software for extracting informat…
- client: GROBID service – clients-for-grobid-web-services – GROBID Documentation
功能:
- tei xml 导出
- 文本 pdf 位置坐标
- reference, abstract, author, …
pdfx
- GitHub - metachris/pdfx: Extract text, metadata and references (pdf, url, doi…
功能
- text
- reference
- metadata
- 引用文献下载
borb
- GitHub - jorisschellekens/borb: borb is a library for reading, creating and m…
- GitHub - jorisschellekens/borb-examples
功能
- 文本抽取
- json 化
- 向 pdf 添加或修改内容:metadata, 文本,图片,表格,注释 …
pdfact
Apache Tika
aspose pdf java
paddleocr + ppstructure
Pix2Text
- GitHub - breezedeus/Pix2Text: An Open-Source Python3 tool for recognizing lay…
- 图片转 markdown, 特殊字符识别效果好
表格抽取
tabula-py / tablula-java
- 支持 OCR, 支持转成 pandas
PaddleOCR 执行表格抽取
camelot
- 不支持 OCR
img2table
- GitHub - xavctn/img2table: img2table is a table identification and extraction…
- 支持 PaddleOCR, tesseract, google 等多种 ocr 工具
- 使用例子:Extracting tables from images in Python | Better Programming
ocr-table
pdftables
- 停止开发
pdftabextract
- GitHub - WZBSocialScienceCenter/pdftabextract: A set of tools for extracting …
- 不支持 ocr
- 需要是 OCR 过的 pdf
工具对比
参考:
| |
pdf ocr 层添加工具
什么是 pdf unit
参考
- 1 pdf unit == 1 inch
使用案例
grobid
https://grobid.readthedocs.io/en/latest/Coordinates-in-PDF/
contrary to usage, the origin of a document is at the upper left corner. The x-axis extends to the right and the y-axis extends downward,
all locations and sizes are stored in an abstract value called a PDF unit,
PDF documents do not have a resolution: to convert a PDF unit to a physical value such as pixels, an external value must be provided for the resolution.
DPI 问题
- grobid 坐标换算
DPI 72 - 打印机一般
DPI 300
pdf 转图片
表格图片抽取
GitHub - allenai/pdffigures2: Given a scholarly PDF, extract figures, tables,…
- 标题
- 区域坐标
- 页码
GitHub - titipata/scipdf_parser: Python PDF parser for scientific publication…
- 文本 + 图片
- 底层使用 grobid + pdffigures2
表格识别:microsoft/table-transformer-detection · Hugging Face
- 图片表格区域识别
pdfact
解析 PDF 成 json
效果:
- 支持非论文的 pdf
支持中文
- 但是测试,中文的论文效果有时会很差
参考:
- GitHub - ad-freiburg/pdfact: A basic tool that extracts the structure from th…
- https://hub.docker.com/r/dnlbauer/pdfact-service
pdfact docker 使用
镜像: docker run -it --rm -p 80:80 dnlbauer/pdfact-service
使用: curl -H "Accept: application/json" -F file=@testfile.pdf localhost:80/analyze
MinerU + pdf extract kit 笔记
MinerU 代码分析
layout 结果分析处理
magic_pdf/model/magic_model.py::MagicModel__init__()
处理 layout 信息的如卡代码:
magic_pdf/pdf_parse_union_core.py::pdf_parse_union()
中文 PDF 识别抽取
版面分析模型
参考:
百度
- picodet_lcnet_x1_0_fgd_layout_cdla: 9.7M, CDLA 数据集训练的中文版面分析模型,可以划分为表格、图片、图片标题、表格、表格标题、页眉、脚本、引用、公式 10 类区域
360
rapid layout
- 中英文论文、通用场景分别提供了不同的模型
上海 AI 研究所
标注方法和工具
数据集
文章作者
上次更新 2025-02-24 (77fafc9)