Skip to main content

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

PDF Markdown
Screenshot 2026-02-11 at 21 54 00 Screenshot 2026-02-11 at 22 20 52

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paper_structure-0.1.1.tar.gz (54.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

paper_structure-0.1.1-py3-none-any.whl (70.1 kB view details)

Uploaded Python 3

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

Hashes for paper_structure-0.1.1.tar.gz
Algorithm Hash digest
SHA256 60abbc4706dd83f9132ae19d7de6d5f0fc9e513edd017d6579d69f6f0af5ae19
MD5 63f82656a7ae06a1283b8923964e1e8c
BLAKE2b-256 331511a57be980eff7b12228a5622ff3e1dbff139de96fbdc174051613981b01

See more details on using hashes here.

Provenance

The following attestation bundles were made for paper_structure-0.1.1.tar.gz:

Publisher: pypi.yml on yuanjua/PaperStructure

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file paper_structure-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for paper_structure-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3bda7d8f6cf653b409a8e8ad1b779b1e628715b7a7e9cc806d3c2ca1b37cc7b9
MD5 b506ee1aaa48bd93dec32cd543b518b9
BLAKE2b-256 38b7548485ef15bd6113327c0e0adf1f0c971e8a27e97bc2784d5c6cac8373a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for paper_structure-0.1.1-py3-none-any.whl:

Publisher: pypi.yml on yuanjua/PaperStructure

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page