Skip to main content

English to Bengali transliteration library

Project description

Bnlish

English to Bengali transliteration library

Description

Banglish is a Python library that provides transliteration from English (Roman script) to Bengali (Bangla script). It includes comprehensive character mappings for vowels, consonants, and vowel signs (kar), as well as a dictionary of common words.

Features

  • Bidirectional transliteration: English to Bengali and Bengali to English
  • Character-by-character transliteration with compound consonant support
  • Support for Bengali vowels, consonants, and vowel signs
  • Extensive common words dictionary (200+ words)
  • Simple and easy-to-use API
  • Word suggestions for incomplete typing

Installation

pip install bnlish

Usage

Three-Way Transliteration

Your Banglish library now supports three-way conversion between English, Banglish, and Bengali:

# Import all conversion functions
import banglish as bnlish

# 1. English to Banglish
english_text = "I am very good today"
banglish_text = bnlish.en_to_banglish(english_text)
print(banglish_text)  # Output: 

# 2. Banglish to English  
banglish_text = "ridoye tomar kirtan baje"
english_text = bnlish.banglish_to_en(banglish_text)
print(english_text)  # Output: 

# 3. Banglish to Bengali
banglish_text = "ridoye tomar kirtan baje"
bengali_text = bnlish.banglish_to_bn(banglish_text)
print(bengali_text)  # Output: হৃদয়ে তোমার কীর্তন বাজে

# 4. Bengali to Banglish
bengali_text = "হৃদয়ে তোমার কীর্তন বাজে"
banglish_text = bnlish.bn_to_banglish(bengali_text)
print(banglish_text)  # Output: ridoye tomar kirtan baje

Advanced Usage

# For more control, use the translator class
import banglish as bnlish
translator = bnlish.BanglishTranslator()

# Direct method calls
print(translator.to_banglish("tumi kemon acho"))  # English to Bengali
print(translator.to_banglish_from_bengali("তুমি কেমন আছো"))  # Bengali to English

# Word suggestions
suggestions = translator.suggest("bha")
print(suggestions)  # [{'english': 'bhalo', 'bangla': 'ভালো'}, ...]

Alternative imports (also available):

from bnlish import translate, bengali_to_banglish  # Same functions, different names

Requirements

  • Python 3.7+
  • regex >= 2023.0.0

Development

Install development dependencies

pip install -e .[dev]

Run tests

pytest

Code formatting

black .

License

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

Author

Debashish Roy thedeba@icloud.com

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

bnlish-1.0.1.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

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

bnlish-1.0.1-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bnlish-1.0.1.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for bnlish-1.0.1.tar.gz
Algorithm Hash digest
SHA256 066927653e85af317d2b4256ae0a97c60b8c4865740c2599b85323b35907e369
MD5 498788cfa67dd188e565ff64e23ada5d
BLAKE2b-256 61e5232073074d4490431c6ec9c9f7d895a65a2625ae5b25872a73ce2f386513

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bnlish-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for bnlish-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0f8e0b2ec77c98d6fc55a5faf232b035dd041b9dfc75638db738306289c127ce
MD5 390b4293155fed4c651fd456a9677c64
BLAKE2b-256 d06c6a2b5d8fbaa3560d8f4ea5b2a68ac4c5cbe0688d09438ee8d8edbb0c0fb3

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