OCR for DjVu (Python 3 fork)
Project description
Overview
ocrodjvu is a wrapper for OCR systems that allows you to perform OCR on DjVu files.
Example
$ wget -q 'https://sources.debian.org/data/main/o/ocropus/0.3.1-3/data/pages/alice_1.png'
$ gm convert -threshold 50% 'alice_1.png' 'alice.pbm'
$ cjb2 'alice.pbm' 'alice.djvu'
$ ocrodjvu --in-place 'alice.djvu'
Processing 'alice.djvu':
- Page #1
$ djvused -e print-txt 'alice.djvu'
(page 0 0 2488 3507
(column 470 2922 1383 2978
(para 470 2922 1383 2978
(line 470 2922 1383 2978
(word 470 2927 499 2976 "1")
(word 588 2926 787 2978 "Down")
(word 817 2925 927 2977 "the")
(word 959 2922 1383 2976 "Rabbit-Hole"))))
(column 451 707 2076 2856
(para 463 2626 2076 2856
(line 465 2803 2073 2856
(word 465 2819 569 2856 "Alice")
(word 592 2819 667 2841 "was")
(word 690 2808 896 2854 "beginning")
⋮
Requisites
The following software is required to run ocrodjvu:
Python 3
an OCR engine:
DjVuLibre ≥ 3.5.21 (≥ 3.5.26 for latest python-djvulibre)
python-djvulibre ≥ 0.4
Please note that installing this package currently is a bit more complicated since Cython 3 has been relased on 2023-07-17.
While Issue #11 is unresolved, PyPI releases require some workarounds (installing the package from the source archive with the deprecated python setup.py install beforehand).
Alternative: Install the latest package version from Git.
lxml ≥ 2.0
Additionally, some optional features require the following software:
PyICU ≥ 1.0.1 — required for the --word-segmentation=uax29 option
html5lib — required for the --html5 option
The following software is required to rebuild the manual pages from source:
Installation
The easiest way to install ocrodjvu is from PyPI:
pip install ocrodjvu
Alternatively, you can use ocrodjvu without installing it, straight out of an unpacked source tarball or a VCS checkout.
It’s also possible to install it from source for the current interpreter with:
pip install .
The man pages can be deployed using:
make install_manpage
By default, make install_manpage installs them to /usr/local/. You can specify a different installation prefix by setting the PREFIX variable, e.g.:
make install PREFIX="$HOME/.local"
About this fork
This repository is a port of the original repository to Python 3.
The process involved the 2to3 tool and manual fixes afterwards to get the existing tests to pass. While this port started from scratch to already include the latest upstream changes, the fork by @rmast which accumulated previous porting attempts provided some great help (see Issue #39 as well).
Due to the upstream repository having been archived (Issue #46), this fork will now be maintained on its own. Please note that I do not have any plans on implementing completely new features for now. Nevertheless, I am going to try to keep this fork working for at least the parts which I actually use on a regular basis.
Differences from upstream
Package requires Python ≥ 3.6.
Migrate from nose to plain unittest stdlib module.
Conform to PEP8 coding style.
Use standardized setup.py-based installation.
Rename lib to ocrodjvu and migrate ocrodjvu binary to __main__.py and console script version.
Drop support for ocropus/ocropy as only the rather old legacy versions ≤ 0.3.1 from 2008 have been supported.
Acknowledgment
ocrodjvu development was supported by the Polish Ministry of Science and Higher Education’s grant no. N N519 384036 (2009–2012, https://bitbucket.org/jsbien/ndt).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ocrodjvu-0.13.2.tar.gz
.
File metadata
- Download URL: ocrodjvu-0.13.2.tar.gz
- Upload date:
- Size: 54.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 472eceb2023854e0a790930c9bdc546a797ae658852425d7c2bd4573d60cc434 |
|
MD5 | 5ebae56829b0f47ea94abf884cec380d |
|
BLAKE2b-256 | 1ac9ed2fdcc2a731a94c69b109b847408897318f8ba8348dca594330815abba3 |
Provenance
The following attestation bundles were made for ocrodjvu-0.13.2.tar.gz
:
Publisher:
release.yml
on FriedrichFroebel/ocrodjvu
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
ocrodjvu-0.13.2.tar.gz
- Subject digest:
472eceb2023854e0a790930c9bdc546a797ae658852425d7c2bd4573d60cc434
- Sigstore transparency entry: 149105409
- Sigstore integration time:
- Predicate type:
File details
Details for the file ocrodjvu-0.13.2-py3-none-any.whl
.
File metadata
- Download URL: ocrodjvu-0.13.2-py3-none-any.whl
- Upload date:
- Size: 58.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fec74e6ab6d2a56ec0a7f034e35139144fc8aa0111706b7199035f88e77898c |
|
MD5 | 923622b1b0f10bc1ea7d52c13e2d8a9c |
|
BLAKE2b-256 | 650ba6a379c971c955e3f6c5f7106ecc10ea16682bdb3381d6015bd5b5420bb1 |
Provenance
The following attestation bundles were made for ocrodjvu-0.13.2-py3-none-any.whl
:
Publisher:
release.yml
on FriedrichFroebel/ocrodjvu
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
ocrodjvu-0.13.2-py3-none-any.whl
- Subject digest:
8fec74e6ab6d2a56ec0a7f034e35139144fc8aa0111706b7199035f88e77898c
- Sigstore transparency entry: 149105411
- Sigstore integration time:
- Predicate type: