Skip to main content

Bulgarian Text Normalizer for TTS

A comprehensive text normalization package that converts written Bulgarian text into its spoken form, designed as a preprocessing step for Text-to-Speech (TTS) systems.

Features

Category Examples
Numbers 1500 → хиляда и петстотин
Dates 15.02.2026 г. → петнадесети февруари две хиляди двадесет и шеста година
Time 14:30 ч. → четиринадесет и тридесет часа
Currency 99.99 лв. → деветдесет и девет лева и деветдесет и девет стотинки, 12.50 € → дванадесет евро и петдесет евроцента
Scale words 1,5 млн. → един и половина милиона, 5 хил. → пет хиляди
Units 1 км → един километър, -5°C → минус пет градуса, 60 км/ч → шестдесет километра в час
Fractions 3/4 → три четвърти
Ranges 5-10 км → пет до десет километра, 2025/2026 г. → две хиляди двадесет и пета, двадесет и шеста година
Percentages 15.5% → петнадесет цяло и пет десети процента
Ordinals 21-ви → двадесет и първи
Abbreviations бул. Витоша, гр. София → булевард Витоша, град София
Phone numbers 0888 123 456 → нула осем осем осем едно две три четири пет шест
Roman numerals век XXI → век двадесет и първи
Symbols №10 → номер десет, No 15 → номер петнадесет

Grammatical Correctness

  • Gender agreement: Handles masculine/feminine/neuter (един/една/едно, два/две)
  • Ordinal forms: Full gender-aware ordinals (първи/първа/първо)
  • Year reading: Ordinal feminine form matching "година" (две хиляди двадесет и шеста)
  • Space-separated thousands: 7 000 000 → седем милиона

Usage

Quick usage

from bg_text_normalizer import normalize_text

result = normalize_text("На 15.02.2026 г. в 14:30 ч. цената е 1500.50 лв.")
# "На петнадесети февруари две хиляди двадесет и шеста година в четиринадесет
#  и тридесет часа цената е хиляда и петстотин лева и петдесет стотинки."

Class-based usage

from bg_text_normalizer import BulgarianTextNormalizer

normalizer = BulgarianTextNormalizer(expand_abbrevs=True, verbose=False)
result = normalizer.normalize("бул. Витоша №10, гр. София")
# "булевард Витоша номер десет, град София"

A Roman numeral after a capitalized name (Карл V) is left alone by default, since Марк I can be a product name. Turn it on with roman_numerals=True:

BulgarianTextNormalizer(roman_numerals=True).normalize("Борис III управлява.")
# "Борис трети управлява."

A lone C, D, L or M after a name is skipped, because it is usually an initial.

Individual modules

from bg_text_normalizer.bg_numbers import number_to_words_cardinal, number_to_words_ordinal
from bg_text_normalizer.bg_dates import normalize_date
from bg_text_normalizer.bg_currency import normalize_currency

number_to_words_cardinal(2500, gender='m')    # "две хиляди и петстотин"
number_to_words_ordinal(15, gender='m')       # "петнадесети"
normalize_date(15, 2, 2026)                   # "петнадесети февруари две хиляди двадесет и шеста"
normalize_currency("99.99", "BGN")            # "деветдесет и девет лева и деветдесет и девет стотинки"

Integration with TTS Training (Qwen3-TTS)

Use this normalizer as a preprocessing step when preparing your training data:

import json
from bg_text_normalizer import normalize_text

# Process your JSONL training data
with open('raw_data.jsonl', 'r') as f_in, open('normalized_data.jsonl', 'w') as f_out:
    for line in f_in:
        entry = json.loads(line)
        entry['text'] = normalize_text(entry['text'])
        f_out.write(json.dumps(entry, ensure_ascii=False) + '\n')

For inference (runtime TTS), add normalization before synthesis:

from bg_text_normalizer import normalize_text

def synthesize(text: str):
    normalized = normalize_text(text)
    # ... pass normalized text to TTS model

File Structure

bg-text-normalizer/
├── src/
│   └── bg_text_normalizer/
│       ├── __init__.py           # Package entry point
│       ├── bg_normalizer.py      # Main orchestrator
│       ├── bg_numbers.py         # Cardinal, ordinal, decimal numbers
│       ├── bg_dates.py           # Date normalization
│       ├── bg_time.py            # Time normalization
│       ├── bg_currency.py        # Currency (BGN, EUR, USD, GBP)
│       ├── bg_scales.py          # хил., млн., млрд.
│       ├── bg_units.py           # Measurement units with count forms
│       ├── bg_punctuation.py     # Keeps an abbreviation's period only at sentence end
│       ├── bg_abbreviations.py   # 100+ Bulgarian abbreviations
│       ├── bg_phone.py           # Phone number reading
│       └── bg_roman.py           # Roman numeral conversion
├── test_normalizer.py            # Test suite
├── pyproject.toml
└── README.md

Adding Custom Abbreviations

Edit src/bg_text_normalizer/bg_abbreviations.py and add entries to the appropriate dictionary:

# In ADDRESS_ABBREVS, TITLE_ABBREVS, etc.
CUSTOM_ABBREVS = {
    'your_abbrev.': 'пълна форма',
}

Dependencies

None — pure Python, no external dependencies required.

Metadata

Release files for bg-text-normalizer 1.3.0

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

Source distribution (sdist)

Source distribution for bg-text-normalizer 1.3.0
File Size Uploaded
bg_text_normalizer-1.3.0.tar.gz 27.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bg-text-normalizer 1.3.0
File Interpreter ABI Platform
bg_text_normalizer-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 57.4 kB

Release files / bg_text_normalizer-1.3.0.tar.gz

Download URL bg_text_normalizer-1.3.0.tar.gz
Size 27.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e5670543bd9055eb2b6d2206d1e393ae6237c50d172f58bbcdf0ee484f69a478
BLAKE2b-256 checksum
How to use checksums
3c452dfac9d226bae66739860c12c29c03bd6a28c9808ea11b6528b663463e3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / bg_text_normalizer-1.3.0-py3-none-any.whl

Download URL bg_text_normalizer-1.3.0-py3-none-any.whl
Size 30.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5481458b7bd997945b433ebf89f7d169d5eb0b8dbca1501f5a9466895f34ad35
BLAKE2b-256 checksum
How to use checksums
2defbc1f70a8135aed7c8ee00864bffdff595feb66d1f3c3587e90bcbbd4449e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

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