Skip to main content

Belarusian text normalizer

Project description

Belarusian Text Normalization Library

This library provides tools for preparing Belarusian text for Text-to-Speech (TTS) applications. Key features include:

  • Splitting text into sentences
  • Normalizing numbers and abbreviations
  • Handling common Belarusian contractions and special symbols

Designed for easy integration, this library helps ensure that text is correctly formatted and pronounced by TTS systems.

Usage example

from BelNorm import BelSplitter, NormalizerLLM
from BelG2P import BelG2PWrapper

g2p=BelG2PWrapper()
normalizer=NormalizerLLM("gemini/gemini-flash-lite-latest")
splitter=BelSplitter()

text="Нейкі беларускі тэкст. І прачытаць яго трэба 3 разы."
print(f"Input text: {text}")

for paragraph in splitter.parse([text]):
    for sentence in paragraph:
        if not sentence.is_normalized:
            print("Normalization required: "+sentence.text)
            sentence.normalize(normalizer.normalize)
            print(sentence.text)
        print(sentence.convert_tts(g2p.convert))

Do not forget to add some environment variable for LLM usage. For Gemini, it should be GEMINI_API_KEY.

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

belnorm-0.3.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

belnorm-0.3.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file belnorm-0.3.0.tar.gz.

File metadata

  • Download URL: belnorm-0.3.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for belnorm-0.3.0.tar.gz
Algorithm Hash digest
SHA256 2e64ac659bb4e899381434ee6b79bd74cf76d9849c44ea771810da81ded0554a
MD5 041d9101e5f88823f827bb7290404723
BLAKE2b-256 3cf7d049ebc5beaab30bda971e53453b52cb004d896fa286a8a8c3e332558b8c

See more details on using hashes here.

File details

Details for the file belnorm-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: belnorm-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for belnorm-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0baa1179d40c5bd568f762aa2e3c692bbee28a8c6ce2937ba805608d3f60df4
MD5 4c70ffaf900952e9eabc520de11710fd
BLAKE2b-256 890f671678eb123bebfa505e81d18ef892b7967723d2eef2378d56157de77f61

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