A package to convert numbers to Bengali/Bangla text and numerals with currency formatting support
Project description
num2bangla
A powerful Python package for converting numbers to Bengali/Bangla text and numerals, with comprehensive support for currency formatting. Perfect for financial documents, invoices, and applications requiring Bengali number representation.
🚀 Features
- 📝 Convert numbers to words in Bangla or English
- 💱 Flexible currency formatting (e.g., "Taka", "টাকা")
- 🔢 Support for Bengali numerical digits
- 💯 Handle decimal numbers in traditional (পয়সা) or modern (দশমিক) style
- 📊 Process multiple numbers simultaneously
- 🔄 Support for large numbers (up to crores)
- 💻 Command-line interface (CLI)
- ⚙️ Highly customizable output format
📦 Installation
pip install num2bangla
🎯 Quick Start
Basic Usage
from num2bangla import taka
# Simple conversion
result = taka(200) # "Two Hundred Taka Only"
### Advanced Usage
```python
from num2bangla import TakaConverter
# Bangla output with traditional paisa style
converter = TakaConverter(lang="bn", currency="টাকা", extension="মাত্র")
result = converter.convert_number(200.25)
# Output: "দুই শত টাকা এবং পঁচিশ পয়সা মাত্র"
# Modern decimal style in Bangla
converter = TakaConverter(
lang="bn",
currency="টাকা",
extension="মাত্র",
decimal_style="decimal"
)
result = converter.convert_number(42.25)
# Output: "বিয়াল্লিশ দশমিক দুই পাঁচ টাকা মাত্র"
# Using Bengali numerals
converter = TakaConverter(numerical_digits="bn")
result = converter.convert_number(1234.56, return_numerical=True)
# Output: "১২৩৪.৫৬"
# Multiple numbers at once
converter = TakaConverter(lang="en", currency="USD", extension="Only")
results = converter.convert_multiple(200, 100, 300)
# Output: ["Two Hundred USD Only", "One Hundred USD Only", "Three Hundred USD Only"]
Comprehensive Configuration
converter = TakaConverter(
lang="bn", # Language: "bn" for Bangla, "en" for English
currency="টাকা", # Currency text
extension="মাত্র", # Extension text
decimal_style="decimal", # Decimal style: "default" or "decimal"
numerical_digits="bn" # Numerical digits: "bn" or "en"
)
text_result = converter.convert_number(42.25)
# Text format: "বিয়াল্লিশ দশমিক দুই পাঁচ টাকা মাত্র"
numeral_result = converter.convert_number(42.25, return_numerical=True)
# Numeral format: "৪২.২৫"
🖥️ Command Line Interface
The package includes a convenient command-line interface:
# Basic conversion
num2bangla 42.25
# Multiple numbers
num2bangla 100 200.50 1234.56
# Full configuration example
num2bangla 42.25 \
--lang bn \
--currency টাকা \
--extension মাত্র \
--decimal-style decimal \
--numerical-digits bn
CLI Options
| Option | Description | Values |
|---|---|---|
--lang |
Output language | bn, en |
--currency |
Currency text | e.g., টাকা, Taka |
--extension |
Extension text | e.g., মাত্র, Only |
--decimal-style |
Decimal format | default, decimal |
--numerical-digits |
Numeral style | bn, en |
--numerical-only |
Show only numerals | flag |
📝 Configuration Options
TakaConverter Parameters
| Parameter | Default | Description |
|---|---|---|
lang |
"en" |
Output language ("bn" or "en") |
currency |
"Taka" |
Currency text to use in output |
extension |
"Only" |
Extension text to append |
decimal_style |
"default" |
Decimal number style |
numerical_digits |
"en" |
Numeral style for numerical output |
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🤝 Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.
💬 Support
If you have any questions or need help, please open an issue on GitHub.
Project details
Release history Release notifications | RSS feed
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 num2bangla-1.0.0.tar.gz.
File metadata
- Download URL: num2bangla-1.0.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f6fa291cf1dc8e62707f5dbbfb065c803c4ed954a93ddbe89dc1469ea6a01a6
|
|
| MD5 |
284ff74377895e4c671f7822d93f3e92
|
|
| BLAKE2b-256 |
8e774176d23a6c5ec98381a806c71e5195aef8563c39f5f1a8ec33d9cdff92e4
|
File details
Details for the file num2bangla-1.0.0-py3-none-any.whl.
File metadata
- Download URL: num2bangla-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e895b74a8e365cf70ed934042665237be5604088b15437217746a8295559b75c
|
|
| MD5 |
d9f66aba058ea000664ed7c039cf6599
|
|
| BLAKE2b-256 |
dcc98d9ab9dd3fb8a3017e528c9a219f7a4bbe0e57b2136b2cbf25a214d7d26d
|