old-doc
Easily create synthetic data for HTR (Handwritten Text Recognition) and OCR (Optical Character Recognition).
Description
old-doc is a Python package designed to generate synthetic data for training and testing HTR and OCR models. This tool streamlines the process of creating diverse datasets for improving text recognition systems, allowing users to generate custom manuscript-like pages with various text styles, layouts, and effects.
Installation
You can install old-doc using pip:
pip install old-doc
Note: old-doc requires Python 3.8 or later.
Features
- Generate synthetic handwritten text images
- Create synthetic printed document images
- Customize text content, fonts, layouts, and degradation effects
- Support for curved text, drop caps, and marginalia
- Export data in image format and ALTO XML for HTR and OCR tasks
Usage
Here's an example of how to use old-doc to create a sample manuscript page:
from old_doc import TextBlock, Column, Row, Page
title = TextBlock("Simple Document", block_type="heading", font_size=40, font_color=(100, 0, 0))
content = TextBlock("This is a sample text for our document. " * 5,
font_size=16, font_color=(0, 0, 0),
curve_amount=0.1, # Slight curve to the text
word_spacing=10
)
# Create layout
header_row = Row([Column([title], width=800)], height=60)
content_row = Row([Column([content], width=800)], height=400)
# Create page
page = Page([header_row, content_row],
cell_padding=20,
background_color=(250, 240, 230)) # Light parchment color
# Generate the page
image, alto = page.generate()
# Save the results
image.save("example.png")
page.save_alto_xml("example.alto.xml")
# Display the image (optional, requires matplotlib)
page.visualize_results()
This example creates a manuscript page with a header, date, main content with curved text and potential drop caps, and marginalia. It then generates the page, visualizes it, and saves both the image and ALTO XML output.
Metadata
Release files for old-doc 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| old_doc-0.0.3.tar.gz | 6.4 kB | Without provenance | Details for old_doc-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| old_doc-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for old_doc-0.0.3-py3-none-any.whl |
Total release size: 19.9 kB
Release files / old_doc-0.0.3.tar.gz
| Download URL | old_doc-0.0.3.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2df8f6cd2a252b66ec4ae4efd27d3572de3541d1110ba811c7757e361b04820d
|
|
BLAKE2b-256 checksum How to use checksums |
4c371c93ab377ab4a61a0508fca9537699e1faffba75206a080b7cc11bdc58fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.5
|
Release files / old_doc-0.0.3-py3-none-any.whl
| Download URL | old_doc-0.0.3-py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8a76dd90a137f3e1b7aea2a668e533b236e4b8c82621ed4ce9eb35bdbb5b1c09
|
|
BLAKE2b-256 checksum How to use checksums |
33984eb7716f96c70903901d172bd749a602d8fa894d3203fd1b9b5c96327d06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.5
|
Security for old-doc 0.0.3
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.