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.2.0.tar.gz (52.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.2.0-py3-none-any.whl (47.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: oq_ai_ocr-0.2.0.tar.gz
  • Upload date:
  • Size: 52.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.2.0.tar.gz
Algorithm Hash digest
SHA256 2e4fbcc0b1e0c4d3a84a35bab7fb9034291c9f78226816a8d49e03095a08ca6a
MD5 24192e89d93df4354beb9284065a434c
BLAKE2b-256 f06029ff1d19fc370c293f87d0532f15f2765df7ecc245cc62d05f4976cba75a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oq_ai_ocr-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 47.5 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf241db5466c082f2c4cd1f63537dc8ea05aaaeaca6e8febfa245fb857a8a294
MD5 678535fd09e0e18d1b7eb3e0443fba1c
BLAKE2b-256 236f6e89c46ebded4ce14d3821caa8892041aea2b0f65b19351d19fa146f324f

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