Skip to main content

vig2p

Vietnamese G2P wrapper around sea-g2p with 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 th rewrite first raw t -> θ, including unaccented Vietnamese words like theo
  • source words starting tr rewrite first raw ʧ -> ʈʂ
  • source words starting s rewrite first raw s -> ʂ, including unaccented Vietnamese words like sinh; obvious non-Vietnamese s clusters such as st/sp/sk/... are left alone
  • source words starting gi/gì variants rewrite first raw z -> ʝ
  • e- -> æ
  • 1/7 -> →, 2 -> ↘, 3/ɜ -> ↗, 4 -> ↓, 5 -> ʔ↗, 6 -> ʔ↓
  • ɗ -> d, ʐ -> ʒ, đ -> d
  • curly apostrophes behave like apostrophes
  • – -> —
  • unsupported *, /, & are stripped or spaced before training phonemes

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/*

Metadata

Release files for vig2p 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vig2p 0.1.2
File Size Uploaded
vig2p-0.1.2.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vig2p 0.1.2
File Interpreter ABI Platform
vig2p-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 12.3 kB

Release files / vig2p-0.1.2.tar.gz

Download URL vig2p-0.1.2.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5b89e632994ce7be4a5657b5e3b674fa8eb5284495cf34fa0fdd919ee1efa5d0
BLAKE2b-256 checksum
How to use checksums
8833e10f954c7a005dbb3adbd0f99c1005c6957235173c3bf72d0f3e40a7e59e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / vig2p-0.1.2-py3-none-any.whl

Download URL vig2p-0.1.2-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12f2a3bb55247aec119d816e7a5506b7c25e1020d6c28c0ab6fb81c679cdc078
BLAKE2b-256 checksum
How to use checksums
d8f0c4cf9481c6b19d57fa88c797c45ca9eb099b1b6fbfa22229b3f701e14bdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page