Skip to main content

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

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

vig2p-0.1.1.tar.gz (15.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vig2p-0.1.1-py3-none-any.whl (15.1 MB view details)

Uploaded Python 3

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

Hashes for vig2p-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ba49f7ebc8e403a164b861a7d9de4a059d278ec18c4d03e12cbbb31b70902a48
MD5 b60adca738c872c4183ecd96e6dec5c5
BLAKE2b-256 91ce9e1a93e175f2e801e9765ff8e86fb7b9065ad488f74880e92de3eb33b1a7

See more details on using hashes here.

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

Hashes for vig2p-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cd1a4cd79294c8cccc2d43049a434b33db3e882cf0781db128697afbab5496be
MD5 fafc7146890aa6be462a076f26d85a66
BLAKE2b-256 a05b2178ec1c35dc7258698eb92d7eec2f28e7f2bb00b1b9364eb8378267995d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page