Skip to main content

tesseract-heb-rivok

heb_rivok and heb_rivok_lite are Tesseract 5 models for printed Hebrew, fine-tuned by Rivok Labs. This package installs them with pip and tells Tesseract where they are. You still need Tesseract itself (apt install tesseract-ocr, brew install tesseract, or the Windows installer).

pip install tesseract-heb-rivok
model for version
heb_rivok Hebrew documents with English words and numbers, old print and niqqud. English is in the model, so no +eng 2.0
heb_rivok_lite Hebrew and niqqud, about as fast as the standard heb model; add +eng for English 2.0

Using heb_rivok in a project or product? We'd love to hear about it: ronen@rivoklabs.com.

The files are the integer ("fast") models from the GitHub release. The float models are there too: heb_rivok's float file reads vowels a little better, at about 1.3× the time per line, and both are the starting point for further fine-tuning.

Use

python -m tesseract_heb_rivok prints the folder that holds the two models:

tesseract page.png out --tessdata-dir "$(python -m tesseract_heb_rivok)" -l heb_rivok

From Python with pytesseract:

import pytesseract
import tesseract_heb_rivok

text = pytesseract.image_to_string(
    "page.png", lang="heb_rivok",
    config=f'--tessdata-dir "{tesseract_heb_rivok.tessdata_dir()}"')

When Tesseract needs more than these two models. Some uses need Tesseract's own files as well: another language (-l heb_rivok_lite+eng), page rotation (osd) or output configs (hocr, pdf). OCRmyPDF and Docling need them too. For these, use the merged folder: --merged builds a folder in your cache that links these models and everything in your system's tessdata.

export TESSDATA_PREFIX="$(python -m tesseract_heb_rivok --merged)"
ocrmypdf -l heb_rivok scanned.pdf searchable.pdf
tesseract page.png out -l heb_rivok_lite+eng hocr

Docling, with its Tesseract command-line engine:

import os
import tesseract_heb_rivok
from docling.datamodel.pipeline_options import OcrMode, PdfPipelineOptions, TesseractCliOcrOptions

tessdata = tesseract_heb_rivok.merged_tessdata_dir()
os.environ["TESSDATA_PREFIX"] = tessdata          # Docling lists languages without --tessdata-dir
opts = PdfPipelineOptions()
opts.ocr_options = TesseractCliOcrOptions(lang=["heb_rivok"], path=tessdata, mode=OcrMode.FULL_PAGE)

python -m tesseract_heb_rivok --check verifies the files and that Tesseract loads them.

Results

Character error rate, lower is better; Tesseract 5.5.0. Each model against the Google tessdata_best model it was fine-tuned from; this package installs our int8 files. The last column is Ubuntu's heb, what most people have installed: Google's tessdata_fast model, a smaller, separately trained network, not an int8 copy of tessdata_best.

test Google script/Hebrew (tessdata_best, float) heb_rivok (int8) Google heb (tessdata_best, float) heb_rivok_lite (int8) Ubuntu heb (tessdata_fast)
150 line crops from real Hebrew documents 4.0% 1.2% 4.0% 1.7% 4.7%
Four old books (1872–1922), 1,087 lines 7.8% 2.7% 11.2% 4.8% 11.3%
… the vowelled Selichot 1885: vowel marks read (higher is better) 56% 82% 17% 61% 23%
GlotOCR-bench Hebrew, clean images 20.7% 10.9% 24.6% 13.2% 21.2%
HaZefira newspaper, 4,013 line crops 14.3% 4.8% 17.7% 6.3% 17.5%

Google's heb can output only 6 vowel marks (shva, hiriq, segol, patah, qamats, dagesh), so most of the lite model's vowel gain is marks it cannot write at all, not marks it misreads.

Method, more tests and how the models were trained are in the model card. The 150 crops come from private documents; the four old books are public-domain scans with Hebrew Wikisource transcriptions; GlotOCR-bench and HaZefira are public, and the repository's eval/ scripts rerun those numbers.

Files

file SHA-256
heb_rivok.traineddata (5.7 MB) 09ef1830f3393c590791abf9c18deca14450c8e5d3b556249d63b0183cf7a426
heb_rivok_lite.traineddata (3.5 MB) 59da073ad0bca9449fa5a965996e49d0e2bee3c17e8b0b4e2769d67a7ce34c40

Licence

Apache-2.0, like the tessdata_best models and langdata_lstm text they are built on.

Metadata

Release files for tesseract-heb-rivok 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tesseract-heb-rivok 2.0.1
File Size Uploaded Provenance Actions
tesseract_heb_rivok-2.0.1.tar.gz 4.1 MB Without provenance Details for tesseract_heb_rivok-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tesseract-heb-rivok 2.0.1
File Interpreter ABI Platform Actions
tesseract_heb_rivok-2.0.1-py3-none-any.whl Python 3 none any Details for tesseract_heb_rivok-2.0.1-py3-none-any.whl

Total release size: 8.3 MB

Release files / tesseract_heb_rivok-2.0.1.tar.gz

Download URL tesseract_heb_rivok-2.0.1.tar.gz
Size 4.1 MB
Tags Source
SHA-256 checksum
How to use checksums
c4ff35f6e03c8fddab6af89fc9589fda3666508e25118121f8617824b63752c7
BLAKE2b-256 checksum
How to use checksums
c50e6cec7c76fd5a3c27e2dc6a273b29e699e295e13811c51187e992485d7473
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / tesseract_heb_rivok-2.0.1-py3-none-any.whl

Download URL tesseract_heb_rivok-2.0.1-py3-none-any.whl
Size 4.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
2beaa752545d2264fefc68282781a13dbd5f3ba1917ffd2af2155487d9f010cd
BLAKE2b-256 checksum
How to use checksums
e7b12e713118e2bf5908e6eb0cc8ffe4f9881b3c23d8cb3ed56cf33e1bfd0179
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for tesseract-heb-rivok 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page