Skip to main content

Bangla Text Normalizer

PyPI version License: MIT Python 3.6+

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/YYYY formats.
    • Context-aware dates: 21 -> একুশে (Ekmshe), 01 -> পহেলা (Pohela).
    • Smart Year handling: 1952 -> ঊনিশশো বাহান্ন (Nineteen Hundred Fifty-Two), 2024 -> দুই হাজার চব্বিশ.
  • Phone Numbers:
    • Normalizes BD phone numbers (e.g., 017..., +88017...) into individual digits.
    • Robust handling of spaces and hyphens (e.g., 017 11000000).
  • Ordinals:
    • Supports numeric ordinals: 1st, 2nd, 10th.
    • Supports Bangla short-forms: ১ম, ২য়, ১০ম.
    • Auto-generates ordinals for large numbers: 1023rd -> এক হাজার তেইশতম.
  • 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

Metadata

Release files for bangla-text-normalizer 0.1.1

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

Source distribution (sdist)

Source distribution for bangla-text-normalizer 0.1.1
File Size Uploaded Provenance
bangla_text_normalizer-0.1.1.tar.gz 8.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for bangla-text-normalizer 0.1.1
File Interpreter ABI Platform
bangla_text_normalizer-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.6 kB

Release files / bangla_text_normalizer-0.1.1.tar.gz

Download URL bangla_text_normalizer-0.1.1.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b47625d931e658d0b929547be64063352e5798b7f036858f4660d98fac7c8e6b
BLAKE2b-256 checksum
How to use checksums
641b8f8b0eda462caa3e526c5564631bf9b80a9aa9633da6a36f9bc83ddc034c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / bangla_text_normalizer-0.1.1-py3-none-any.whl

Download URL bangla_text_normalizer-0.1.1-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a1e0192dfd6c83061c0e9db4c2ceb89c522726f4b902a16c2b869eee22ec30f
BLAKE2b-256 checksum
How to use checksums
9d10e6d5f4cd33fc2cdcd67e9ade5a8b9b354649583280c6580b6c84133aed85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Security for bangla-text-normalizer 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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