Skip to main content

A package to convert numbers to Indonesian words

Project description

Indonesian Number Normalizer

A Python package for converting numbers to Indonesian words. This package is particularly useful for Text-to-Speech (TTS) preprocessing where numbers need to be converted to their word representations.

Features

  • Convert numbers to Indonesian words
  • Support for:
    • Integers
    • Decimal numbers
    • Currency (IDR, USD, EUR)
    • Percentages
    • Time
    • Ordinal numbers
  • Automatic number detection in text
  • Comprehensive text normalization

Installation

pip install indonesian-number-normalizer

Quick Start

from indonesian_number_normalizer import create_normalizer

# Create normalizer instance
normalizer = create_normalizer()

# Convert simple numbers
print(normalizer.number_to_words(1234))  # "seribu dua ratus tiga puluh empat"

# Convert currency
print(normalizer.convert_currency(4150))  # "empat ribu seratus lima puluh rupiah"

# Normalize text containing numbers
text = "Harga saham naik 2,5% menjadi Rp4.150 per lembar."
normalized = normalizer.normalize_text(text)
print(normalized)  # "Harga saham naik dua koma lima persen menjadi empat ribu seratus lima puluh rupiah per lembar."

Advanced Usage

Currency Conversion

# Indonesian Rupiah
normalizer.convert_currency(1500000)  # "satu juta lima ratus ribu rupiah"

# US Dollar
normalizer.convert_currency(1500.50, currency="USD")  # "seribu lima ratus dolar lima puluh sen"

# Euro
normalizer.convert_currency(1500.50, currency="EUR")  # "seribu lima ratus euro lima puluh sen"

Time Conversion

normalizer.convert_time("09:30")  # "sembilan lewat tiga puluh menit"

Percentage Conversion

normalizer.convert_percentage(2.5)  # "dua koma lima persen"

Ordinal Numbers

normalizer.convert_ordinal(3)  # "ketiga"

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

indonesian_number_normalizer-0.1.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file indonesian_number_normalizer-0.1.0.tar.gz.

File metadata

File hashes

Hashes for indonesian_number_normalizer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 79d1771e509657b6cdd114772326810f956b29ed3dae5b11bcb902338f828538
MD5 0eaaa50a369a8a4eb2d2cd5f2c72109b
BLAKE2b-256 11fb445ff01bf064c3ed46c9ed00db92f33a816a2305d83fb86757193ad5ec7b

See more details on using hashes here.

File details

Details for the file indonesian_number_normalizer-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for indonesian_number_normalizer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a026204e65d32ce91aa53a500054a072ed0ee74ca0e73369ccd4bb3a3438469
MD5 d58d6ae59aeccb13d42ff90cc93d088a
BLAKE2b-256 bbd35a940f935c77632b681b74fef042d00471dbd1f60a5d6b137e7c9f59249d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page