Skip to main content

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

Contributing

Contributions are welcome. The recommended flow is:

  1. Update mapping data or conversion logic.
  2. Add or update regression cases in tests/test_cases.json.
  3. Run the test suite.
  4. 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

kannada_ascii_unicode-0.1.5.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kannada_ascii_unicode-0.1.5-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

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

Hashes for kannada_ascii_unicode-0.1.5.tar.gz
Algorithm Hash digest
SHA256 5a51974948be5886048024bcc25015d232eac5c6d8f292812b590321da2b5b3e
MD5 b1ca51af6fa7627b1f16af56187291ff
BLAKE2b-256 0b8e533a0dd3e8aa054c22520970e1f95b20375933bb35246e32e0bd3e9b288f

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kannada_ascii_unicode-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for kannada_ascii_unicode-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8d208a9a4d4088839624c6ce880f563e408f4b7f0fe05620a792dff1e1ba541a
MD5 76a807209af3bc03481f35b1ee9ac475
BLAKE2b-256 51532da7f9c326d277d15063a70f3242086725553014842719a519ef034a5a13

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page