جSindhi-Jev
Use it

Python API

Everything the command line does is one class: sindhijev.tool.Checker.

Example

from sindhijev.tool import Checker

ck = Checker("sindhijev_v2.onnx")          # or Checker() with SINDHIJEV_WEIGHTS set

r = ck.check("word.png", "ڪلوواٽ اهي")
print(r["p_wrong"], [r["text"][i] for i in r["suspicious"]])

fixed, changes = ck.repair("word.png", "ڪلوواٽ اهي")
ranked = ck.pick("word.png", ["ڪلوواٽ اهي", "ڪلوواٽ آهي"])

Checker(weights=None, threads=None)

Loads the ONNX model and the bundled Noto Naskh Arabic font (OFL). threads sets ONNX Runtime's intra-op threads.

check(image, text) → dict

image is a file path or a NumPy array (grayscale or BGR). Returns text (normalised), p_wrong, chars and suspicious, as described in check.

check_many(image, texts) → list[dict]

Same as check for several texts on one crop. Each text is scored in its own forward pass (see batching).

repair(image, text, margin=0.6, top_k=3, max_edits=2) → (str, list)

Returns the repaired text and a list of changes {"from", "to", "p_wrong": [before, after]}.

pick(image, candidates) → list[dict]

Returns the check results for the unique candidates, best (lowest p_wrong) first.

tesseract_candidates(image, engines=None, tess="tesseract", psm=7) → dict

Runs installed Tesseract language models on the crop and returns {engine: text}.

Text normalisation

Before scoring, text is NFC-normalised, zero-width joiners are removed, spaces are collapsed, and Latin , ; ? become Arabic ، ؛ ؟, exactly as in training and evaluation.

Sindhi-Jev by Arsalan Kaleem (ORCID 0009-0002-9054-6965) · Apache-2.0 · source on GitHub · numbers on this site come from the repository's result files; nothing here was tuned on the real test set.