Skip to main content

indic-language-utils

indic-language-utils is a provider-neutral Python library for Indic text and speech processing. It unifies language detection, translation, transliteration, script identification, and speech tools under a single, standardized interface, abstracting local and cloud engines so you can switch providers without rewriting code.

PyPI version Downloads Python License CI

Key Features

  • Provider Neutrality: Code against high-level capability interfaces. Swap, configure, or chain providers without changing text processing or domain code.
  • Text Translation: Translate plain text or complex Markdown documents across 22 scheduled Indian languages and English.
  • Text Language Detection: Identify languages using offline FastText classification (lid.176.ftz) or cloud inference pipelines via Bhashini.
  • Transliteration: Convert between Roman script and native Indic scripts via Bhashini or Aksharamukha.
  • Speech to text: Transcribe audio with Bhashini, Sarvam, Gnani, local Faster-Whisper, or keyless Google Speech.
  • Text to speech: Generate audio with Bhashini, Sarvam, Gnani, Navana, or Edge TTS and pass model-specific voice settings.
  • Script Identification: Fast, zero-dependency Unicode script identification across 12+ Indic scripts and Latin.
  • Document and Code Protection: Structural pre-processors and post-processors protect headings, bullet markers, inline code spans, URLs, and code blocks from neural translation corruption.
  • Resilient Execution: Automatic multi-provider fallback routing, bounded concurrency limits per provider, and exponential backoff retries with jitter.
  • High-Performance Caching: In-memory LRU and multi-process SQLite caches with write-ahead logging (WAL mode) and stampede protection.
  • Canonical Normalization: Shared language registry recognizing all 22 Eighth Schedule Indian languages plus English, mapping aliases and regional codes to BCP 47.
  • Localization Catalogs: Match reviewed human translations for critical UI strings before dispatching to neural engines.

Getting started

Install the core package with pip install indic-language-utils. Provider selection is explicit, and local detection requires an optional extra. The installation and quick start guide covers a credential-free setup, Bhashini configuration, and the first detection and translation calls.

Quick start with a coding agent

The integration skill gives a coding agent installation steps, first calls, and provider choices. Point your agent to the raw skill file when asking it to add an Indian-language feature to your project:

Use https://raw.githubusercontent.com/Hari31416/indic-language-utils/main/skills/indic-language-utils/SKILL.md to add translation to this project.

You can also install the skill into your project with the skills CLI:

npx skills add Hari31416/indic-language-utils --skill indic-language-utils

Supported Providers

Provider Capability Mode Prerequisites
Aksharamukha Transliteration (120+ scripts) Offline / Local [local-transliteration] extra
Bhashini Translation, Detection, Transliteration, STT, TTS Cloud API API key, Endpoint, Service ID
Sarvam AI Translation, Detection, STT, TTS Cloud API API key (SARVAM_API_KEY)
Gnani AI STT, TTS Cloud API API key (GNANI_API_KEY)
Navana AI TTS Cloud API API key (NAVANA_API_KEY)
FastText Text Language Detection Offline / Local [local-tld] extra
Faster-Whisper Speech to text Offline / Local [stt-whisper] extra
Google Free STT Speech to text Cloud (unofficial) [stt-google-free] extra
Google Translate Translation Cloud (unofficial) [googletrans] extra
Microsoft Edge TTS Text to speech Cloud (unofficial) [tts-edge] extra

Configuration

The library uses a tiered configuration system combining project TOML files (.indic-language-utils.toml), environment variables, and programmatic overrides.

Example .indic-language-utils.toml:

[cache]
enabled = true
backend = "sqlite"
path = ".cache/translations.sqlite3"
max_entries = 50000
ttl_seconds = 86400

[retry]
max_attempts = 3
base_delay_seconds = 0.25
max_delay_seconds = 5.0

[providers.bhashini]
endpoint = "https://dhruva-api.bhashini.gov.in/services/inference/pipeline"
translation_service_id = "default-translation-model-id"
detection_service_id = "default-tld-model-id"
transliteration_service_id = "default-transliteration-model-id"
max_concurrency = 8

[providers.sarvam]
endpoint = "https://api.sarvam.ai"
model = "sarvam-translate:v1"
stt_model_id = "saaras:v4"
tts_model_id = "bulbul:v3"
max_concurrency = 8

[providers.navana]
endpoint = "https://tts.navana.ai"
max_concurrency = 8

[routes]
translation = ["sarvam", "bhashini", "googletrans"]
text_language_detection = ["sarvam", "bhashini", "fasttext"]
transliteration = ["bhashini", "aksharamukha"]
speech_to_text = ["bhashini", "sarvam", "google_free", "faster_whisper"]
text_to_speech = ["bhashini", "sarvam", "navana", "edge_tts"]

Supply credentials securely through environment variables:

export BHASHINI_API_KEY="your-bhashini-api-key"
export SARVAM_API_KEY="your-sarvam-api-key"
export NAVANA_API_KEY="your-navana-api-key"

Documentation

Comprehensive guides are available in the documentation site:

Development

Install the locked development environment with uv:

uv sync --dev
uv run pre-commit install

Run test suite, code quality checks, and local documentation server:

uv run ruff format --check .
uv run ruff check .
uv run mypy
uv run pytest
uv build
uv run mkdocs serve
uv run mkdocs build --strict

Interactive Testing Workbench

A local evaluation workbench and REST API server is included for testing translation, detection, transliteration, STT, and TTS interactively. The web assets are built from a source checkout and are not included in the Python wheel:

# Build the web interface
cd web && pnpm install && pnpm build && cd ..

# Launch the FastAPI server with static UI mounted at http://127.0.0.1:8000
uv run indic-server

Explore interactive API documentation at http://127.0.0.1:8000/docs.

License

This project is licensed under the MIT License.

Metadata

Release files for indic-language-utils 1.2.0

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

Source distribution (sdist)

Source distribution for indic-language-utils 1.2.0
File Size Uploaded Provenance Actions
indic_language_utils-1.2.0.tar.gz 480.1 kB With provenance Details for indic_language_utils-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for indic-language-utils 1.2.0
File Interpreter ABI Platform Actions
indic_language_utils-1.2.0-py3-none-any.whl Python 3 none any Details for indic_language_utils-1.2.0-py3-none-any.whl

Total release size: 642.4 kB

Release files / indic_language_utils-1.2.0.tar.gz

Download URL indic_language_utils-1.2.0.tar.gz
Size 480.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f13239d434981720ab265de01c5e5afacd400d6936ffde96e51241686a2dffcf
BLAKE2b-256 checksum
How to use checksums
efbdf73afec13ad4e2f634115d51d39cbb4973d57a593617082d6db69fd01c70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / indic_language_utils-1.2.0-py3-none-any.whl

Download URL indic_language_utils-1.2.0-py3-none-any.whl
Size 162.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d029717b41b391e12ccb5623d0c83daf816dbc95c483e43b0da77e6bf4d73d4
BLAKE2b-256 checksum
How to use checksums
28b20f23c64a2a592fe255867f6e33efb17e27adb6a676e38b0d9f8d4c3e46e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Security for indic-language-utils 1.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for indic_language_utils-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

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.

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