vnnum2word
Convert numbers to words, with a focus on the Vietnamese language.
This project is inspired by num2words.
The original num2words library formats numbers into floats with two decimal places. For example:
from num2words import num2words
num2words(12.5, lang='vi')
# mười hai phẩy năm mươi
num2words(12.556, lang='vi')
# mười hai phẩy năm mươi sáu
However, in Vietnamese, these results are often inaccurate or unnatural. This package fixes those issues and provides more accurate and natural outputs for Vietnamese numbers.
Installation
pip install vnnum2word
Usage
from vnnum2word import convert_number, convert_string
convert_number(12.5)
# mười hai phẩy năm
convert_string("giải thưởng là 1000000 đồng")
# giải thưởng là một triệu đồng
convert_string("mã abc123def")
# mã abc một hai ba def
Unittest
python -m unittest tests/number.py
python -m unittest tests/string.py
Release files for vnnum2word 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vnnum2word-0.3.0.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vnnum2word-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.1 kB
Release files / vnnum2word-0.3.0.tar.gz
| Download URL | vnnum2word-0.3.0.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7956969846f494d6bf6aed2d4ae4ab4ed26800f3aa4f0749b96010ad2058b935
|
|
BLAKE2b-256 checksum How to use checksums |
c42b745b9b32c7fd7f5db69e677a5132f91f90467802e7e8f96d4bda62819c38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / vnnum2word-0.3.0-py3-none-any.whl
| Download URL | vnnum2word-0.3.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f285b9b0c933c51077a34d0149211c1edc9a14bdbf5b9008d4307c75d6258556
|
|
BLAKE2b-256 checksum How to use checksums |
f1bfdeda12310dc0092890a96f4c9d7e00ad3b7ac4c242454d1ed59d275ead9d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|