Skip to main content

Vietnamese G2P wrapper for Kokoro-compatible phonemes

Project description

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

Project details


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.0.tar.gz (7.1 kB 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.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file vig2p-0.1.0.tar.gz.

File metadata

  • Download URL: vig2p-0.1.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for vig2p-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7a38a4491fa424a2d6c5a378309bf8cb90c682b2cbcbc20906442cfe197768a9
MD5 465dca4fdadead4cff6293b4d7b6db30
BLAKE2b-256 df717713683d9b4baebf4f1b814e59ee0a40f366846f710f58bcac744a104a2d

See more details on using hashes here.

File details

Details for the file vig2p-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: vig2p-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2dc7bfdd615fa3de93c82cc1d153fc9b009bfe9f0e494985ce8cc23047183c14
MD5 3abf19f29042cd5571eeb47c4bb75ae0
BLAKE2b-256 234024cfb29428ca118a2d052957aa5d2de59e39e54eee262478953d5ecfb552

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 Pingdom Monitoring Sentry Error logging StatusPage Status page