A robust text normalizer tool for Bangla language
Project description
Bangla Text Normalizer
A robust, dependency-free Bangla Text Normalizer (Bengali Text Normalizer) Python package designed for NLP (Natural Language Processing) and TTS (Text-to-Speech) pipelines. It accurately converts numeric symbols, dates, time, currencies, phone numbers, and abbreviations into their spoken Bangla textual format.
Unlike other tools, this package handles the Indian Numbering System (Lakh/Crore) correctly and provides context-aware normalizations for improved audio data quality.
This tool is optimized for:
- Text-to-Speech (TTS) Preprocessing: Converting raw text into perfectly pronounceable Bangla words.
- ASR & NLP Data Preparation: Standardizing text for training machine learning models.
- Chatbots & Voice Assistants: Ensuring textual responses are ready for voice synthesis.
Installation
pip install bangla-text-normalizer
Usage
from bangla_text_normalizer import BanglaTextNormalizer
normalizer = BanglaTextNormalizer()
# Example 1: Addresses and Numbers
text = "৫ম তলা, ৩/বি, গুলশান-২, ঢাকা ১২১২"
print(normalizer.normalize(text))
# Expected Output:
# পঞ্চম তলা, ৩/বি, গুলশান-২, ঢাকা এক দুই এক দুই
# Example 2: Dates (Smart Pronunciation)
print(normalizer.normalize("21/02/1952"))
# Output: একুশে ফেব্রুয়ারি ঊনিশশো বাহান্ন
# Example 3: Phone Numbers
print(normalizer.normalize("01711000000"))
# Output: শূন্য এক সাত এক এক শূন্য শূন্য শূন্য শূন্য শূন্য শূন্য
# Example 4: Decimals and Fractions
print(normalizer.normalize("3.5"))
# Output: তিন দশমিক পাঁচ
Features
- Number Conversion: Converts integers to text (Supports extremely large numbers like Lakhs/Crores).
- Date Normalization:
- Handles
DD/MM/YYYYformats. - Context-aware dates:
21->একুশে(Ekmshe),01->পহেলা(Pohela). - Smart Year handling:
1952->ঊনিশশো বাহান্ন(Nineteen Hundred Fifty-Two),2024->দুই হাজার চব্বিশ.
- Handles
- Phone Numbers:
- Normalizes BD phone numbers (e.g.,
017...,+88017...) into individual digits. - Robust handling of spaces and hyphens (e.g.,
017 11000000).
- Normalizes BD phone numbers (e.g.,
- Ordinals:
- Supports numeric ordinals:
1st,2nd,10th. - Supports Bangla short-forms:
১ম,২য়,১০ম. - Auto-generates ordinals for large numbers:
1023rd->এক হাজার তেইশতম.
- Supports numeric ordinals:
- Decimals & Fractions: Handles floating point numbers (
3.1416) and simple fractions (1/2). - Zero Dependency: Pure Python implementation with no external requirements.
License
MIT License
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 bangla_text_normalizer-0.1.1.tar.gz.
File metadata
- Download URL: bangla_text_normalizer-0.1.1.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b47625d931e658d0b929547be64063352e5798b7f036858f4660d98fac7c8e6b
|
|
| MD5 |
43a843da8100b16f5f74b15471d63919
|
|
| BLAKE2b-256 |
641b8f8b0eda462caa3e526c5564631bf9b80a9aa9633da6a36f9bc83ddc034c
|
File details
Details for the file bangla_text_normalizer-0.1.1-py3-none-any.whl.
File metadata
- Download URL: bangla_text_normalizer-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a1e0192dfd6c83061c0e9db4c2ceb89c522726f4b902a16c2b869eee22ec30f
|
|
| MD5 |
265ec2b95b875966d9f102d1092c8fcd
|
|
| BLAKE2b-256 |
9d10e6d5f4cd33fc2cdcd67e9ade5a8b9b354649583280c6580b6c84133aed85
|