Skip to main content

A package to convert numbers to Indonesian words

Project description

Indonesian Number Normalizer 🔢

Convert numbers to Indonesian words for Text-to-Speech preprocessing.

PyPI version Tests License: MIT

Overview

Transform numeric text into natural Indonesian words:

"Harga saham naik 2,5% menjadi Rp4.150"

"Harga saham naik dua koma lima persen menjadi empat ribu seratus lima puluh rupiah"

Features 🌟

  • Numbers: Integers, decimals, negatives
  • Currency: IDR, USD, EUR
  • Formats: Percentages, time, ordinals
  • Text Processing: Automatic number detection and normalization

Installation 📦

pip install indonesian-number-normalizer

Quick Usage 🚀

from indonesian_number_normalizer import create_normalizer

normalizer = create_normalizer()

# Basic numbers
normalizer.number_to_words(1234)  
# "seribu dua ratus tiga puluh empat"

# Currency
normalizer.convert_currency(4150)  
# "empat ribu seratus lima puluh rupiah"

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

Advanced Usage 🛠️

Currency

# Multiple currency support
normalizer.convert_currency(1500000)      # IDR
normalizer.convert_currency(1500.50, "USD")  # USD
normalizer.convert_currency(1500.50, "EUR")  # EUR

Time

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

Percentages & Ordinals

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

Development 🔧

# Clone repository
git clone https://github.com/fiddien/indonesian-number-normalizer.git
cd indonesian-number-normalizer

# Install development dependencies
pip install -e ".[test]"

# Run tests
pytest

Contributing 🤝

Contributions welcome!

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License 📄

MIT License - see LICENSE for details.

Citation 📚

@software{indonesian_number_normalizer,
  title = {Indonesian Number Normalizer},
  author = {Ilma Aliya Fiddien},
  year = {2024},
  url = {https://github.com/fiddien/indonesian-number-normalizer}
}

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.1.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for indonesian_number_normalizer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d89adec99e59563b651f4c8302a551bc7680d4909463891956ea1433a1fb2afc
MD5 5b02faa5d4cf7e1bd0bbe4213933d2ef
BLAKE2b-256 d502b8d7d5af950bb9dc749177008ac1e3e3d6f784a4bf1d83094189b5910fc6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for indonesian_number_normalizer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72afb5ae12fb0fdce9db315934813c00fa62f7d5a58e9b1059eefa2e0359dade
MD5 a6b1698bf811c17d84d3cbf629636a25
BLAKE2b-256 bcf534a283694ae5319dbc1a66bc452d0accc96637c2dc4d49a1f5df6a959fc6

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