quangdon
quangdon is a G2P engine designed for vansarah models.
Hosted demo: https://hf.co/spaces/mr-don88/quangdon-G2P
English Usage
You can run this in one cell on Google Colab:
!pip install -q "quangdon[en]"
from quangdon import en
g2p = en.G2P(trf=False, british=False, fallback=None) # no transformer, American English
text = '[quangdon](/kwɑŋˈdɑn/) is a G2P engine designed for [vansarah](/vænˈsærə/) models.'
phonemes, tokens = g2p(text)
print(phonemes) # kwɑŋˈdɑn ɪz ə ʤˈitəpˈi ˈɛnʤən dəzˈInd fɔɹ vænˈsærə mˈɑdᵊlz.
To fallback to espeak:
# Installing espeak varies across platforms, this silent install works on Colab:
!apt-get -qq -y install espeak-ng > /dev/null 2>&1
!pip install -q "quangdon[en]" phonemizer-fork
from quangdon import en, espeak
fallback = espeak.EspeakFallback(british=False) # en-us
g2p = en.G2P(trf=False, british=False, fallback=fallback) # no transformer, American English
text = 'Now outofdictionary words are handled by espeak.'
phonemes, tokens = g2p(text)
print(phonemes) # nˈW Wɾɑfdˈɪkʃənˌɛɹi wˈɜɹdz ɑɹ hˈændəld bI ˈispik.
English
- https://github.com/explosion/spaCy
- https://github.com/savoirfairelinux/num2words
- https://github.com/mr-don88/quangdon/blob/main/EN_PHONES.md
Japanese
The second gen Japanese tokenizer now uses pyopenjtalk with full unidic, enabling pitch accent marks and improved phrase merging. Deep gratitude to @sophiefy for invaluable recommendations and nuanced help with pitch accent.
The first gen Japanese tokenizer mainly relies on cutlet => fugashi => mecab => unidic-lite, with each being a wrapper around the next. Deep gratitute to @Respaired for helping me learn the ropes of Japanese tokenization before any vansarah model had started training.
- https://github.com/polm/cutlet
- https://github.com/polm/fugashi
- https://github.com/ikegami-yukino/jaconv
- https://github.com/studio-ousia/mojimoji
Korean
The Korean tokenizer is copied from 5Hyeons's g2pkc fork of Kyubyong's widely used g2pK library. Deep gratitute to @5Hyeons for kindly helping with Korean and extending the original code by @Kyubyong.
Chinese
The second gen Chinese tokenizer adapts better logic from paddlespeech's frontend. Jieba now cuts and tags, and pinyin-to-ipa is no longer used.
The first gen Chinese tokenizer uses jieba to cut, pypinyin, and pinyin-to-ipa.
- https://github.com/fxsjy/jieba
- https://github.com/mozillazg/python-pinyin
- https://github.com/stefantaubert/pinyin-to-ipa
Vietnamese
TODO
- Data: Compress data (no need for indented json) and eliminate redundancy between gold and silver dictionaries.
- Fallbacks: Train seq2seq fallback models on dictionaries using this notebook.
- Homographs: Escalate hard words like
axes bass bow lead tear windusing BERT contextual word embeddings (CWEs) and logistic regression (LR) models (nn.Linearfollowed by sigmoid) as described in this paper. Assumingtrf=True, BERT CWEs can be accessed viadoc._.trf_data, see en.py#L479. Per-word LR models can be trained on WikipediaHomographData, llama-hd-dataset, and LLM-generated data. - More languages: Add
ko.py,ja.py,zh.py. - Per-language pip installs
Acknowledgements
- 🛠️ quangdon builds on top of many excellent G2P projects linked above.
- 🌐 Thank you to all native speakers who advised and contributed G2P in many languages.
- 👾 vansarah Discord server: https://discord.gg/QuGxSWBfQy
- 🌸 quangdon is a Japanese name and a character in the Terminator franchise along with vansarah.
Metadata
Release files for quangdon 0.9.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| quangdon-0.9.6.tar.gz | 1.6 MB | Without provenance | Details for quangdon-0.9.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| quangdon-0.9.6-py3-none-any.whl | Python 3 | none | any | Details for quangdon-0.9.6-py3-none-any.whl |
Total release size: 3.1 MB
Release files / quangdon-0.9.6.tar.gz
| Download URL | quangdon-0.9.6.tar.gz |
|---|---|
| Size | 1.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
016216c090a3ec9215c49cbd5249fdbf6a8ed19241cc4ec38839fdd5525edcdb
|
|
BLAKE2b-256 checksum How to use checksums |
d1a0a39b3d4f565e8df733da1c7da0a3558dd729332d2db2ea25a1f639e5db30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.11
|
Release files / quangdon-0.9.6-py3-none-any.whl
| Download URL | quangdon-0.9.6-py3-none-any.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
da2320b37f5a05d5218eb7f6b8b330be861089cf94709e8bab5609cd380d559d
|
|
BLAKE2b-256 checksum How to use checksums |
9d90c301ed09ccea74c3a2c4db079b639f926ac0721eeb8d9ec45430da6c320d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.11
|
Security for quangdon 0.9.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.