A package to convert numbers to Indonesian words
Project description
Indonesian Number Normalizer 🔢
Convert numbers to Indonesian words for Text-to-Speech preprocessing.
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!
- Fork the repository
- Create feature branch (
git checkout -b feature/AmazingFeature
) - Commit changes (
git commit -m 'Add AmazingFeature'
) - Push to branch (
git push origin feature/AmazingFeature
) - 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file indonesian_number_normalizer-0.1.1.tar.gz
.
File metadata
- Download URL: indonesian_number_normalizer-0.1.1.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d89adec99e59563b651f4c8302a551bc7680d4909463891956ea1433a1fb2afc |
|
MD5 | 5b02faa5d4cf7e1bd0bbe4213933d2ef |
|
BLAKE2b-256 | d502b8d7d5af950bb9dc749177008ac1e3e3d6f784a4bf1d83094189b5910fc6 |
File details
Details for the file indonesian_number_normalizer-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: indonesian_number_normalizer-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72afb5ae12fb0fdce9db315934813c00fa62f7d5a58e9b1059eefa2e0359dade |
|
MD5 | a6b1698bf811c17d84d3cbf629636a25 |
|
BLAKE2b-256 | bcf534a283694ae5319dbc1a66bc452d0accc96637c2dc4d49a1f5df6a959fc6 |