Skip to main content

A Hindi transliteration library based on AI4Bharat's IndicXlit

Project description

Hindi Transliteration Library

A Python library for transliterating English text to Hindi using AI4Bharat's model. This library provides a simple interface for converting English words to their Hindi (Devanagari) equivalents.

Features

  • Simple and intuitive API
  • Supports both single word and batch transliteration
  • Returns multiple transliteration candidates
  • CPU-only implementation (no GPU required)
  • Interactive command-line interface

Installation

pip install hindi-xlit

Usage

Basic Usage

from hindi_xlit import HindiTransliterator

# Initialize the transliterator
transliterator = HindiTransliterator()

# Transliterate a single word
word = "namaste"
candidates = transliterator.transliterate(word)
print(f"Transliteration candidates for '{word}':")
for i, candidate in enumerate(candidates, 1):
    print(f"{i}. {candidate}")

# Transliterate multiple words
words = ["hello", "world"]
results = transliterator.transliterate_batch(words)
for word, candidates in zip(words, results):
    print(f"\nTransliteration candidates for '{word}':")
    for i, candidate in enumerate(candidates, 1):
        print(f"{i}. {candidate}")

Command Line Interface

After installing the package (e.g., via pip from PyPI), you can use the command line interface:

hindi-xlit <word> [topk]
  • <word>: The word in Roman script to transliterate (required)
  • [topk]: (Optional) Number of transliteration candidates to return (default: 3)

Examples:

hindi-xlit namaste
# Output:
# Transliteration candidates for 'namaste':
# 1. नमस्ते
# 2. नमसते
# 3. नामसते

hindi-xlit hello 5
# Output:
# Transliteration candidates for 'hello':
# 1. हेलो
# 2. हैलो
# 3. हेलों
# 4. हिलो
# 5. हीलो

If you run the command without arguments, it will show usage instructions.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

This library uses the transliteration model from AI4Bharat.

See CHANGELOG.md for release notes.

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

hindi_xlit-1.0.1.tar.gz (44.6 MB view details)

Uploaded Source

Built Distribution

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

hindi_xlit-1.0.1-py3-none-any.whl (45.1 MB view details)

Uploaded Python 3

File details

Details for the file hindi_xlit-1.0.1.tar.gz.

File metadata

  • Download URL: hindi_xlit-1.0.1.tar.gz
  • Upload date:
  • Size: 44.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for hindi_xlit-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e85f181a6c1d4b0add2411cf26ab29b6a35c2b22b4cd2f94c45303781915093b
MD5 65e325a61700225aec416d37682e7e30
BLAKE2b-256 f24564bbbb465c3fa6a45b12cecc8ab80941be2435d17ec383531ac01bbd81a1

See more details on using hashes here.

File details

Details for the file hindi_xlit-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: hindi_xlit-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 45.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for hindi_xlit-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 64375ecb20337e844a5188da40ee82c582715fde64d2014fa08fa025e0504828
MD5 1adc58b726e7fc24d4b61860ee5bfb37
BLAKE2b-256 1240f790cb05be3d1db4dca0afe615715cd4d25bb0230a8eefeeb4dbbcdcb8bd

See more details on using hashes here.

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