Skip to main content

lekhaka

lekhaka (लेखक, a scribe) turns a printed book of verses into its chapters. Each page is read by a vision model through vishalakshi, local or hosted, as blocks: verses with their printed numbers, headings, colophons. lekhaka gathers the verses into chapters, mends the numbering slips a reader makes, repairs malformed Devanagari akṣaras, and lists what a proofreader should check.

Install

pip install lekhaka

How to use

from lekhaka import read_book, book_md
from vishalakshi import Vault

b = read_book('gita.pdf', Vault('books.db'), model='claude/sonnet', title='Bhagavad Gita',
              hint='Each verse ends in ॥ n ॥.', counts=[47, 72])
b.chapters[0]['verses'][:2]     # [{n, text, page, heading}, ...]
b.probs                         # numbers mended, counts that differ, for a proofreader
print(book_md(b.chapters, 'Bhagavad Gita'))

With a vault the pages are kept as versions of one document: vault.proofread(b.doc_id, readers) has other models read them again, and vault.accept applies the changes the owner chooses. Without a vault nothing is stored.

The pieces work on their own, on the pages vishalakshi.read_doc returns or any {page, blocks} list:

chs, probs = assemble([dict(page=0, blocks=[dict(kind='verse', n='॥१॥', text='क ॥१॥'), dict(kind='verse', n='३', text='ख ॥३॥')])])
[v['n'] for v in chs[0]['verses']], probs
fix_aksharas('ध्ार्म'), vnum('२६॥२७')

Metadata

Release files for lekhaka 0.0.3

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

Source distribution (sdist)

Source distribution for lekhaka 0.0.3
File Size Uploaded
lekhaka-0.0.3.tar.gz 10.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lekhaka 0.0.3
File Interpreter ABI Platform
lekhaka-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 21.8 kB

Release files / lekhaka-0.0.3.tar.gz

Download URL lekhaka-0.0.3.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d7a318003c23da24a9635a29fb0e952eaad1b475dde3e2150fbaeb84349c12a9
BLAKE2b-256 checksum
How to use checksums
63fc58259cd37d82b24e018a28c876de5459e8464aafee877ed5f57de21e0f59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / lekhaka-0.0.3-py3-none-any.whl

Download URL lekhaka-0.0.3-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0c134e9c48aaa79a91c247c0ad9a71dcb154f0598e295facac2e33210d495a6
BLAKE2b-256 checksum
How to use checksums
cc8c9044a240fd41cbdb66465978d469964b3531b085dc57a77a47c87183d850
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

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