Convert numbers to Vietnamese words and Vietnamese words to numbers (with North/South variants)
Project description
vn-numberwords
Convert numbers to Vietnamese words and Vietnamese words to numbers (supports Northern and Southern variants).
Install (from source)
pip install -e .
Usage
from vn_numberwords import number_to_words, number_to_currency, words_to_number, currency_words_to_number, SouthDictionary
# Convert numbers to Vietnamese words
print(number_to_words(1234)) # "một nghìn hai trăm linh bốn"
print(number_to_currency(1234, "đồng")) # "một nghìn hai trăm linh bốn đồng"
print(number_to_words(21, SouthDictionary())) # "hai mươi mốt"
# Convert Vietnamese words to numbers
print(words_to_number("một nghìn hai trăm linh bốn")) # 1234
print(words_to_number("mười một")) # 11
print(words_to_number("một trăm ngàn tỷ")) # 100000000000000
print(currency_words_to_number("một nghìn đồng")) # 1000
Parse Vietnamese-formatted strings:
from vn_numberwords import vietnamese_string_to_words
print(vietnamese_string_to_words("1.234.56")) # decimal example
Features
Number to Words
- Convert numbers to Vietnamese words
- Support for Northern and Southern Vietnamese variants
- Currency formatting
- Large number support (up to trillions)
Words to Number
- Convert Vietnamese words back to numbers
- Support for both accented and non-accented Vietnamese
- Handle complex numbers with multiple magnitude keywords
- Currency parsing
Supported Number Formats
- Units: không, một, hai, ba, bốn, năm, sáu, bảy, tám, chín
- Tens: mười, mươi, chục
- Hundreds: trăm
- Thousands: nghìn, ngàn, nghàn
- Millions: triệu
- Billions: tỷ, tỉ
CLI / Demo
Run the demo script:
python number2word.py
License
MIT
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vn_numberwords-0.2.0.tar.gz.
File metadata
- Download URL: vn_numberwords-0.2.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d9e05d55f79c6fdd681a6a3a0345a8938df30fec2553231d71f0fb3c438ffdb
|
|
| MD5 |
094eb91f42191eb0e2ee6ceebb6475b9
|
|
| BLAKE2b-256 |
077df9692d8080a9539e0dde11587b78fdf7d7617e8d19e236cb1c75576be823
|
Provenance
The following attestation bundles were made for vn_numberwords-0.2.0.tar.gz:
Publisher:
publish.yml on rato-kaz/vn-numberwords
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vn_numberwords-0.2.0.tar.gz -
Subject digest:
3d9e05d55f79c6fdd681a6a3a0345a8938df30fec2553231d71f0fb3c438ffdb - Sigstore transparency entry: 628772244
- Sigstore integration time:
-
Permalink:
rato-kaz/vn-numberwords@dc1e5a0cbd3d3276358aed9f1fc4bdb98cead94e -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/rato-kaz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dc1e5a0cbd3d3276358aed9f1fc4bdb98cead94e -
Trigger Event:
release
-
Statement type:
File details
Details for the file vn_numberwords-0.2.0-py3-none-any.whl.
File metadata
- Download URL: vn_numberwords-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc72ccf8894ac937dfd7966c69010f5117a1ba82ad7a02267722b6f434697cf3
|
|
| MD5 |
056c2767381f59537d68a56bbcb849b0
|
|
| BLAKE2b-256 |
57e4a2a57d5efdc4dd646cb6d32500d8886aff83d3e8d0696bbebf565bf9033a
|
Provenance
The following attestation bundles were made for vn_numberwords-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on rato-kaz/vn-numberwords
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vn_numberwords-0.2.0-py3-none-any.whl -
Subject digest:
cc72ccf8894ac937dfd7966c69010f5117a1ba82ad7a02267722b6f434697cf3 - Sigstore transparency entry: 628772246
- Sigstore integration time:
-
Permalink:
rato-kaz/vn-numberwords@dc1e5a0cbd3d3276358aed9f1fc4bdb98cead94e -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/rato-kaz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dc1e5a0cbd3d3276358aed9f1fc4bdb98cead94e -
Trigger Event:
release
-
Statement type: