Kannada ASCII ↔ Unicode converter (basic mapping-based)
Project description
Kannada ASCII ↔ Unicode Converter
The Kannada ASCII ↔ Unicode Converter is a Python SDK for transforming older Kannada text written in ASCII characters into the corresponding Unicode Kannada characters required by modern applications and systems. It is designed for migration, archival, document processing, and application workflows where legacy Kannada content needs to be displayed and processed correctly in current environments.
What the SDK does
The package supports:
- ASCII-style Kannada text to Unicode conversion
- Unicode Kannada text to ASCII-style output
- batch-style processing for plain text files
- DOCX document conversion with preserved paragraph and run structure
- a simple public API that can be used from scripts, web services, or desktop apps
Why this package exists
Older Kannada text is often stored or exchanged using ASCII-based character representations that were used in legacy systems and documents. This SDK provides a practical bridge between those older ASCII Kannada characters and Unicode, which is the modern standard for correct rendering, storage, and interoperability.
Installation
Install from PyPI:
pip install kannada-ascii-unicode
For local development:
python -m pip install -e .
Quick start
from kannada_converter import KannadaConverter, ascii_to_unicode, unicode_to_ascii
converter = KannadaConverter()
ascii_text = "PÀÄ"
unicode_text = converter.convert_ascii_to_unicode(ascii_text)
print(unicode_text) # ಕು
print(unicode_to_ascii("ಕು")) # PÀÄ
Public API
The SDK exposes a small and focused public API:
from kannada_converter import (
KannadaConverter,
ascii_to_unicode,
ascii_to_unicode_file,
unicode_to_ascii,
unicode_to_ascii_file,
)
Core class
from kannada_converter import KannadaConverter
converter = KannadaConverter()
String conversion
converter.convert_ascii_to_unicode("PÀ")
converter.convert_unicode_to_ascii("ಕ")
File conversion
converter.convert_ascii_to_unicode_file("input.txt", "output.txt")
converter.convert_unicode_to_ascii_file("input.docx", "output.docx")
If no destination path is provided, the converter will infer one automatically.
File support
Plain text files
The text file path handles UTF-8-compatible input and writes converted output while preserving line breaks and spacing.
DOCX files
The DOCX path uses the same conversion engine for paragraph and run content. It is suitable for converting legacy ASCII-style document content into Unicode and vice versa while retaining the document structure.
Architecture overview
The package is organized into three main layers:
- Public API: simple entry points for consumers
- Core engine: conversion logic and special-case handling
- Mapping data: bundled JSON mappings for ASCII ↔ Unicode rules
The implementation uses a trie-based matching approach for lookup efficiency and a mapping-driven engine for Kannada-specific behavior.
Example workflow
from pathlib import Path
from kannada_converter import KannadaConverter
converter = KannadaConverter()
source = Path("sample.txt")
destination = Path("sample.unicode.txt")
converter.convert_ascii_to_unicode_file(source, destination)
Sample application
A runnable sample app is available in testapp/app.py. It demonstrates both string conversion and DOCX conversion.
Run it with:
python testapp/app.py
Development and testing
Create a virtual environment and install the project in editable mode:
python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -e .
pip install pytest python-docx
Run the test suite:
pytest -q
Documentation
Additional documentation is available in the docs/ folder:
Project structure
- kannada_converter/ - package source and public API
- kannada_converter/mappings/ - bundled mapping data
- tests/ - regression tests driven by mapping JSON data
- testapp/ - sample application
- references/ - C# reference implementation used for algorithm inspiration
- publish.ps1 - local publishing helper
Contributing
Contributions are welcome. The recommended flow is:
- Update mapping data or conversion logic.
- Add or update regression cases in tests/test_cases.json.
- Run the test suite.
- Open a pull request with a summary of the change.
License
This project is licensed under the MIT License.
Author
Ravikumar Pawar
GitHub: https://github.com/kagapa-blr
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kannada_ascii_unicode-0.1.5.tar.gz.
File metadata
- Download URL: kannada_ascii_unicode-0.1.5.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a51974948be5886048024bcc25015d232eac5c6d8f292812b590321da2b5b3e
|
|
| MD5 |
b1ca51af6fa7627b1f16af56187291ff
|
|
| BLAKE2b-256 |
0b8e533a0dd3e8aa054c22520970e1f95b20375933bb35246e32e0bd3e9b288f
|
Provenance
The following attestation bundles were made for kannada_ascii_unicode-0.1.5.tar.gz:
Publisher:
python-publish.yml on kagapa-blr/py-kannada-ascii-unicode
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kannada_ascii_unicode-0.1.5.tar.gz -
Subject digest:
5a51974948be5886048024bcc25015d232eac5c6d8f292812b590321da2b5b3e - Sigstore transparency entry: 2077054726
- Sigstore integration time:
-
Permalink:
kagapa-blr/py-kannada-ascii-unicode@fcbe852c747ebd02929180df759a73707d093636 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/kagapa-blr
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@fcbe852c747ebd02929180df759a73707d093636 -
Trigger Event:
push
-
Statement type:
File details
Details for the file kannada_ascii_unicode-0.1.5-py3-none-any.whl.
File metadata
- Download URL: kannada_ascii_unicode-0.1.5-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d208a9a4d4088839624c6ce880f563e408f4b7f0fe05620a792dff1e1ba541a
|
|
| MD5 |
76a807209af3bc03481f35b1ee9ac475
|
|
| BLAKE2b-256 |
51532da7f9c326d277d15063a70f3242086725553014842719a519ef034a5a13
|
Provenance
The following attestation bundles were made for kannada_ascii_unicode-0.1.5-py3-none-any.whl:
Publisher:
python-publish.yml on kagapa-blr/py-kannada-ascii-unicode
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kannada_ascii_unicode-0.1.5-py3-none-any.whl -
Subject digest:
8d208a9a4d4088839624c6ce880f563e408f4b7f0fe05620a792dff1e1ba541a - Sigstore transparency entry: 2077054943
- Sigstore integration time:
-
Permalink:
kagapa-blr/py-kannada-ascii-unicode@fcbe852c747ebd02929180df759a73707d093636 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/kagapa-blr
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@fcbe852c747ebd02929180df759a73707d093636 -
Trigger Event:
push
-
Statement type: