Catalog PyPI
Back to packageRELEASE DETAILS

0.0.1.70

PyPI

abstract-ocr

A structured OCR pipeline designed for layout-aware text extraction from complex documents, combining preprocessing, column detection, region classification, PaddleOCR, and ordered OCR assembly.

Published5 Jul 2026
Direct dependencies30
Transitive dependenciesNot calculated

README

Version 0.0.1.70 documentation

Part of the Abstract Media Intelligence Platform

This module provides layout-aware OCR as part of a larger media processing system.

abstract_ocr focuses on extraction:

  • multi-engine OCR (Tesseract / EasyOCR / PaddleOCR)
  • column detection and region segmentation
  • structured, position-aware text output

Full system: https://github.com/AbstractEndeavors/abstract-media-intelligence


abstract_ocr / layout_ocr — Layout-Aware OCR Pipeline

A structured OCR pipeline designed for layout-aware text extraction from complex documents, combining preprocessing, column detection, region classification, and ordered OCR assembly.

Built to handle:

  • multi-column PDFs
  • mixed-content layouts (text, figures, captions)
  • noisy or scanned documents
  • large-scale document ingestion pipelines

🔹 What This System Is

This is not a simple OCR wrapper — it is a typed, multi-stage processing pipeline:

  • transforms raw images into structured page representations
  • detects document layout (columns, headers, regions)
  • classifies content blocks (text, figures, captions)
  • applies OCR at the region level
  • reconstructs output in correct reading order

The system is designed for deterministic, reproducible extraction rather than heuristic text scraping.


Pipeline Overview

PDF Input
    ↓
Slice / Decompose (images + text per page)
    ↓
OCR + Text Extraction (layout-aware engines)
    ↓
Metadata Generation
    ├─ summaries
    ├─ keywords
    └─ descriptions
    ↓
Manifest Creation (per-page + per-document)
    ↓
HTML Generation
    ├─ PDF viewer pages
    └─ gallery index pages
    ↓
Static Site Output (SEO-ready)
flowchart TD
    A[Input Image / Page Image]
    B[Preprocess\nDenoise + Binarize]
    C[Layout Detection\nColumns + Header Cutoff]
    D[Region Classification\nText / Figure / Caption]
    E[Region OCR\nCrop + Tesseract]
    F[Fallback OCR\nColumn-level OCR]
    G[Reading Order Assembly]
    H[Structured OCRResult\nBlocks + Raw Text + Layout]

    A --> B --> C --> D --> E --> G --> H
    D -->|No usable regions| F --> G

🔹 Core Capabilities

  • Layout Detection

    • Column detection via vertical projection valleys
    • Header segmentation via density scanning
    • Multi-column classification (single / dual / mixed)
  • Region Classification

    • Connected-component analysis
    • Density-based classification (text vs figure vs caption)
    • Column-aware region assignment
  • Region-Level OCR

    • OCR applied per detected block (not full-page)
    • Adaptive Tesseract configuration by region type
    • Automatic fallback to column-level OCR when detection fails
  • Reading Order Reconstruction

    • Column-aware ordering
    • Top-to-bottom sequencing within columns
    • Header/body/caption prioritization
  • Typed Pipeline Execution

    • All steps validated via explicit input/output types
    • Registry-driven execution model
    • No implicit coupling between pipeline stages

🔹 Architecture

The pipeline is built around a step registry + type-safe execution chain:

  • Each step declares:

    • input type
    • output type
  • The pipeline validates compatibility before execution

  • Execution is explicit, deterministic, and observable

Example chain:

["preprocess", "detect_layout", "ocr_regions"]

Each step is independently replaceable and composable.


🔹 Key Design Decisions

Typed Data Flow

All intermediate results are structured dataclasses:

  • PageImage
  • PreprocessedImage
  • LayoutDetection
  • OCRResult

No ad-hoc dictionaries — ensures:

  • traceability
  • consistency
  • debuggability

Layout-First OCR

OCR is applied after structure is understood, not before.

This prevents:

  • column interleaving
  • incorrect reading order
  • misclassification of content

Fallback Over Failure

If region detection fails:

  • system falls back to column-level OCR
  • ensures output is still usable

Determinism Over Heuristics

  • explicit thresholds (config-driven)
  • no hidden behavior
  • reproducible results across runs

🔹 Why This Exists

Traditional OCR pipelines:

  • ignore layout
  • operate on full pages
  • produce inconsistent reading order
  • fail silently on complex documents

This system:

  • understands document structure
  • isolates regions before OCR
  • enforces reading order
  • produces structured outputs suitable for downstream systems

🔹 Example Use Cases

  • PDF → structured text extraction
  • research document ingestion pipelines
  • financial filings parsing
  • multi-column article extraction
  • preprocessing for NLP / LLM pipelines
  • search indexing and document analysis

🔹 Integration Context

This module is designed to plug into:

  • document ingestion systems
  • OCR + NLP pipelines (e.g. abstract_hugpy)
  • search and indexing systems
  • large-scale document processing workflows

🔹 Design Philosophy

  • Structure before extraction
  • Determinism over convenience
  • Typed pipelines over implicit flows
  • Fallback over failure

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 32

Native requirements
30 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
abstract_utilities
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
abstract_utilitiesruntime
abstract_pdfs
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
abstract_pdfs>=0.0.29runtime
paddleocr
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
paddleocr>=3.5.0runtime
paddlepaddle
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
paddlepaddle>=3.2.2runtime
paddlex
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
paddlex>=3.5.2runtime
pdf2image
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
pdf2image>=1.17.0runtime
PyPDF2
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
PyPDF2>=3.0.1runtime
PyMuPDF
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
PyMuPDFruntime
pypdfium2
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
pypdfium2runtime
pdfplumber
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
pdfplumberruntime
pdfminer.six
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
pdfminer.sixruntime
python-docx
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
python-docxruntime
openpyxl
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
openpyxl>=3.1.5runtime
opencv-python-headless
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
opencv-python-headless>=4.13.0.92runtime
pillow
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
pillowruntime
numpy
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
numpyruntime
scikit-image
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
scikit-image>=0.26.0runtime
spacy
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
spacy>=3.8.11runtime
nltk
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
nltk>=3.9.4runtime
beautifulsoup4
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
beautifulsoup4>=4.14.3runtime
lxml
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
lxml>=6.0.2runtime
requests
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
requestsruntime
tqdm
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
tqdm>=4.67.3runtime
PyYAML
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
PyYAMLruntime
packaging
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
packagingruntime
typing_extensions
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
typing_extensionsruntime
moviepy
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
moviepy>=1.0.3runtime
easyocr
Environment
{
  "extras": "",
  "marker": "extra == \"easyocr\"",
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
easyocr>=1.7.2; extra == "easyocr"runtime
pytesseract
Environment
{
  "extras": "",
  "marker": "extra == \"tesseract\"",
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
pytesseract>=0.3.13; extra == "tesseract"runtime
abstract_hugpy
Environment
{
  "extras": "",
  "marker": "extra == \"abstract-hugpy\"",
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
abstract_hugpy; extra == "abstract-hugpy"runtime
easyocr
Environment
{
  "extras": "",
  "marker": "extra == \"all\"",
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
easyocr>=1.7.2; extra == "all"runtime
pytesseract
Environment
{
  "extras": "",
  "marker": "extra == \"all\"",
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
pytesseract>=0.3.13; extra == "all"runtime

Distribution files

2 collected
abstract_ocr-0.0.1.70-py3-none-any.whl

bdist_wheel · 71.05 KB · Python py3

Source file
abstract_ocr-0.0.1.70.tar.gz

sdist · 50.84 KB · Python source

Source file

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 17:42 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:1ad1f0138cba81fb378e6ba94086b9d2c660dffbf19f44d4ec010052dcb6fe37

Other collected versions

View all collected versions →