vig2p
Vietnamese G2P package with an internal pure-Python port of the sea-g2p 0.7.6
backend and the Kokoro-compatible adapter used by the Vietnamese Kokoro
fine-tuning workflow.
Install
pip install vig2p
For local development:
python -m pip install -e ".[dev]"
CLI
vig2p "tường nhà khách. thường nhà khách."
python -m vig2p "trước chước số xố giải dải"
Read one utterance per line:
vig2p --file metadata_texts.txt
JSON output:
vig2p --json "tường nhà khách"
Python
from vig2p import VietnameseG2P, phonemize_text
print(phonemize_text("tường nhà khách"))
g2p = VietnameseG2P()
print(g2p("trước chước số xố giải dải"))
Adapter Policy
tʃ -> ʧt̪ -> t- source words starting
threwrite first rawt -> θ, including unaccented Vietnamese words liketheo - source words starting
trrewrite first rawʧ -> ʈʂ - source words starting
srewrite first raws -> ʂ, including unaccented Vietnamese words likesinh; obvious non-Vietnamesesclusters such asst/sp/sk/...are left alone - source words starting
gi/gìvariants rewrite first rawz -> ʝ e- -> æ1/7 -> →,2 -> ↘,3/ɜ -> ↗,4 -> ↓,5 -> ʔ↗,6 -> ʔ↓ɗ -> d,ʐ -> ʒ,đ -> d- curly apostrophes behave like apostrophes
– -> —- unsupported
*,/,&are stripped or spaced before training phonemes
Backend
vig2p vendors the Apache-2.0 sea-g2p 0.7.6 dictionary as package data and
uses a pure-Python reader/phonemizer in vig2p._sea_g2p. It does not depend on
the external sea-g2p Python package or its Rust extension at runtime.
Test
python -m unittest discover -s tests -v
Publish
Build and check the package:
python -m build
python -m twine check dist/*
Upload to TestPyPI first:
python -m twine upload --repository testpypi dist/*
Then upload to PyPI:
python -m twine upload dist/*
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 vig2p-0.1.1.tar.gz.
File metadata
- Download URL: vig2p-0.1.1.tar.gz
- Upload date:
- Size: 15.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba49f7ebc8e403a164b861a7d9de4a059d278ec18c4d03e12cbbb31b70902a48
|
|
| MD5 |
b60adca738c872c4183ecd96e6dec5c5
|
|
| BLAKE2b-256 |
91ce9e1a93e175f2e801e9765ff8e86fb7b9065ad488f74880e92de3eb33b1a7
|
File details
Details for the file vig2p-0.1.1-py3-none-any.whl.
File metadata
- Download URL: vig2p-0.1.1-py3-none-any.whl
- Upload date:
- Size: 15.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd1a4cd79294c8cccc2d43049a434b33db3e882cf0781db128697afbab5496be
|
|
| MD5 |
fafc7146890aa6be462a076f26d85a66
|
|
| BLAKE2b-256 |
a05b2178ec1c35dc7258698eb92d7eec2f28e7f2bb00b1b9364eb8378267995d
|