Skip to main content

Document ingestion and OCR: byte-level format detection, text-layer-first reading, local PP-OCR engines, an escalation policy, and the eval harness that settles all of it with evidence.

Project description

oq-ai-ocr

Document ingestion and optical character recognition (OCR, reading text off a picture), by OrbitQube. It is everything around the recognition engine and not the engine itself: byte-level format detection, text-layer-before-OCR reading, the format readers, an escalation policy that decides when a model is worth calling, and an eval harness that settles every threshold with a measurement rather than an argument.

This is the Python implementation. A TypeScript one answers the same contract, so a result crosses between them unchanged.

AGPL-3.0-or-later.

Install

The core installs with no recognition engine and no model client at all, which is what lets a consumer prove no model is even present. Extras pull the engine and the document readers:

pip install "oq-ai-ocr[rapidocr,documents]"
  • rapidocr adds PP-OCR on ONNX Runtime, for reading scans.
  • documents adds the PDF, Word, PowerPoint, Excel and image readers.
  • server adds an optional HTTP surface.

Use

from oq_ai_ocr import extract

result = extract(data, filename="statement.pdf")
print(result.text)       # the whole document in reading order
print(result.engine)     # which engine read it, exactly
print(result.warnings)   # coded, one per thing that degraded the reading

What it does, and does not

  • Reads a document's own text first, and recognises pictures only when there is no usable text.
  • Runs locally. No document is sent anywhere. Recognition models download once and cache.
  • Never raises for a document problem. An unreadable page, an unavailable engine, a corrupt zip and a timeout come back as a degraded result carrying warnings, so one bad page does not lose the rest. It raises only for a programming problem.
  • Says what it did. Every result names the engine that read it, marks each page as text-layer or recognised, and carries a coded warning for everything that degraded the reading.
  • No threshold is a guess. Every number that decides behaviour comes from a run of the eval harness and names the run it came from.

Reading order can be wrong

Recognised text is never perfect. Check a figure that matters before you trust it.

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

oq_ai_ocr-0.1.0.tar.gz (28.8 kB view details)

Uploaded Source

Built Distribution

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

oq_ai_ocr-0.1.0-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

Details for the file oq_ai_ocr-0.1.0.tar.gz.

File metadata

  • Download URL: oq_ai_ocr-0.1.0.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for oq_ai_ocr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5552a0a4097f6da73738129caeb595fbe7eaee0b420028a1ee5f55aeb2bc9a01
MD5 8f94c5656a6dbe5233d49a9c41ed52ee
BLAKE2b-256 d31e08f69e70e1bcc27378ad5c28b736d808ffa5ebee849d4f728d9992a40eab

See more details on using hashes here.

File details

Details for the file oq_ai_ocr-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: oq_ai_ocr-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for oq_ai_ocr-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 200c4faef71cf0949f2a8bf528985ee3b3cd71806ee36208aa48bcfbf37400f0
MD5 702621b624a5fc8fbacf2dcc95f5483a
BLAKE2b-256 3e277a9473c753641ac5e74125259deee2c1f7915694fe5846928ee55e730606

See more details on using hashes here.

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