Extract structure and content from academic papers with AI-powered layout detection, OCR, and formula recognition.
Project description
PaperStructure
PaperStructure is a lightweight CLI tool designed to transform academic papers into clean, structured Markdown. By leveraging ONNX models, it delivers high-performance inference optimized for standard laptops. It is a reliable companion for formula-heavy research, though users may currently observe lower accuracy in table recognition.
Features
- Layout Detection -- YOLOX detects titles, sections, paragraphs, formulas, tables, figures
- Text Recognition -- PP-OCRv5 ONNX pipeline
- Formula Recognition -- Encoder-decoder LaTeX OCR
- Markdown Export -- clean, readable markdown output
- Parallel Processing -- multi-threaded PDF page processing
Demo
| Markdown | |
|---|---|
Installation
pip install paper-structure
This registers the paper-structure CLI and installs the Python package.
CLI Usage
# Process a PDF (full pipeline: layout + OCR + formula)
paper-structure process paper.pdf -o output.md
# Shorthand:
paper-structure paper.pdf -o output.md
# OCR an image (text recognition, no layout detection)
paper-structure process photo.png -o output.txt
# Recognize a formula image as LaTeX
paper-structure process formula.png --formula
# PDF options
paper-structure process paper.pdf --max-pages 5 -v --save-images
# Generate annotated preview PDF with bounding boxes
paper-structure preview paper.pdf -o preview.pdf
# Manage models
paper-structure models status
paper-structure models download
Python API
PDF processing (full pipeline)
from paper_structure import PaperStructurePipeline
pipeline = PaperStructurePipeline()
result = pipeline.process_pdf("paper.pdf")
print(result["markdown"])
pipeline.save_markdown(result, "output.md")
Image OCR
from paper_structure import OCR
ocr = OCR()
# Text recognition (default)
print(ocr("table.png"))
# LaTeX formula recognition
print(ocr("formula.png", formula=True))
Model Management
from paper_structure.models import registry
registry.ensure_all() # pre-download everything
print(registry.status()) # show cache status
Models
The tool automatically downloads models on its first call. All model weights are hosted at hpllduck/PaperStructure (~399 MB total) and cached locally via huggingface_hub.
| Group | Files | Description |
|---|---|---|
latex_ocr |
encoder, decoder, image_resizer, tokenizer | RapidLaTeXOCR formula recognition |
yolox |
yolox_l0.05.onnx | YOLOX-L document layout detection |
paddle_ocr |
det, cls, rec, dictionary | PP-OCRv5 text detection/recognition |
License
Apache License 2.0. Individual model weights retain their original licenses (MIT for LaTeX OCR, Apache-2.0 for YOLOX and PaddleOCR).
Acknowledgments
- PaddleOCR -- text recognition
- OnnxOCR -- ONNX OCR pipeline
- RapidLaTeXOCR -- formula recognition
- unstructured-inference -- layout detection
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file paper_structure-0.1.1.tar.gz.
File metadata
- Download URL: paper_structure-0.1.1.tar.gz
- Upload date:
- Size: 54.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60abbc4706dd83f9132ae19d7de6d5f0fc9e513edd017d6579d69f6f0af5ae19
|
|
| MD5 |
63f82656a7ae06a1283b8923964e1e8c
|
|
| BLAKE2b-256 |
331511a57be980eff7b12228a5622ff3e1dbff139de96fbdc174051613981b01
|
Provenance
The following attestation bundles were made for paper_structure-0.1.1.tar.gz:
Publisher:
pypi.yml on yuanjua/PaperStructure
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
paper_structure-0.1.1.tar.gz -
Subject digest:
60abbc4706dd83f9132ae19d7de6d5f0fc9e513edd017d6579d69f6f0af5ae19 - Sigstore transparency entry: 941476858
- Sigstore integration time:
-
Permalink:
yuanjua/PaperStructure@bd5e1168670f49bbd44b338383f295277eb89280 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/yuanjua
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@bd5e1168670f49bbd44b338383f295277eb89280 -
Trigger Event:
release
-
Statement type:
File details
Details for the file paper_structure-0.1.1-py3-none-any.whl.
File metadata
- Download URL: paper_structure-0.1.1-py3-none-any.whl
- Upload date:
- Size: 70.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bda7d8f6cf653b409a8e8ad1b779b1e628715b7a7e9cc806d3c2ca1b37cc7b9
|
|
| MD5 |
b506ee1aaa48bd93dec32cd543b518b9
|
|
| BLAKE2b-256 |
38b7548485ef15bd6113327c0e0adf1f0c971e8a27e97bc2784d5c6cac8373a0
|
Provenance
The following attestation bundles were made for paper_structure-0.1.1-py3-none-any.whl:
Publisher:
pypi.yml on yuanjua/PaperStructure
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
paper_structure-0.1.1-py3-none-any.whl -
Subject digest:
3bda7d8f6cf653b409a8e8ad1b779b1e628715b7a7e9cc806d3c2ca1b37cc7b9 - Sigstore transparency entry: 941476895
- Sigstore integration time:
-
Permalink:
yuanjua/PaperStructure@bd5e1168670f49bbd44b338383f295277eb89280 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/yuanjua
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@bd5e1168670f49bbd44b338383f295277eb89280 -
Trigger Event:
release
-
Statement type: