piper-plus-g2p
Multilingual G2P (Grapheme-to-Phoneme) for TTS. eSpeak-ng free. MIT licensed. 8 languages.
Standalone package — piper-plus TTS エンジンなしで G2P 単体として利用可能です。任意の TTS エンジンと組み合わせて使えます。
Why piper-plus-g2p?
- MIT licensed -- no eSpeak-ng (GPL) dependency in your TTS pipeline
- 8 languages -- JA, EN, ZH, KO, ES, FR, PT, SV with consistent IPA output
- IPA-first design -- returns pure IPA token sequences, ready for any TTS model
Comparison
| piper-plus-g2p | phonemizer | gruut | Misaki | |
|---|---|---|---|---|
| License | MIT | GPL (eSpeak-ng) | MIT | Apache-2.0 |
| Languages | 8 | 100+ | 20+ | EN only |
| eSpeak-ng required | No | Yes | No | No |
| IPA output | Yes | Yes | Yes | Yes |
Installation
pip install piper-plus-g2p # Rule-based languages (ES, FR, PT, SV)
pip install piper-plus-g2p[ja,en] # Japanese + English
pip install piper-plus-g2p[all] # All 8 languages
Note: The
jaextra requirespyopenjtalk-plus, which provides pre-built wheels for Linux, macOS, and Windows. See pyopenjtalk-plus for platform details.
Quick Start
from piper_plus_g2p import get_phonemizer
ja = get_phonemizer("ja")
ja.phonemize("こんにちは")
# -> ["k", "o", "[", "N_n", "n", "i", "ch", "i", "w", "a"]
en = get_phonemizer("en")
en.phonemize("Hello world")
# -> ["h", "ə", "l", "ˈ", "o", "ʊ", " ", "w", "ˈ", "ɜ", "ː", "l", "d"]
Supported Languages
| Language | Code | Extra | Backend | Notes |
|---|---|---|---|---|
| Japanese | ja |
piper-plus-g2p[ja] |
pyopenjtalk-plus | Context-dependent N variants, prosody info |
| English | en |
piper-plus-g2p[en] |
g2p-en | CMU-dict + neural fallback |
| Chinese | zh |
piper-plus-g2p[zh] |
pypinyin | Pinyin-to-IPA, ZH-EN code-switching (loanword pinyinisation) |
| Korean | ko |
piper-plus-g2p[ko] |
g2pk2 | Optional dependency |
| Spanish | es |
-- | Rule-based | No external dependency |
| French | fr |
-- | Rule-based | No external dependency |
| Portuguese | pt |
-- | Rule-based | No external dependency |
| Swedish | sv |
-- | Rule-based | No external dependency |
Advanced Usage
Multilingual (Composite Language Code)
Pass a hyphen-joined code like "ja-en-zh" to get_phonemizer to
automatically create a MultilingualPhonemizer. Language detection is
Unicode-based, so mixed-script text is handled without explicit tagging.
from piper_plus_g2p import get_phonemizer
multi = get_phonemizer("ja-en-zh")
tokens = multi.phonemize("こんにちは Hello 你好")
ZH-EN Code-Switching (English Inside Chinese Context)
When an English token (acronym, brand, technical term) appears next
to a Chinese segment, MultilingualPhonemizer routes it through
ChinesePhonemizer.phonemize_embedded_english so it is rendered as
Mandarin pinyin instead of US English -- matching how Chinese
speakers naturally pronounce inserted English words.
from piper_plus_g2p import get_phonemizer
multi = get_phonemizer("zh-en")
multi.phonemize("请打开 GPS") # GPS -> ji4-pi4-ai1-si4 (pinyin)
multi.phonemize("我喜欢用 Python 写代码") # Python -> pai4-sen1
multi.phonemize("Hello world") # No zh context -> g2p-en (unchanged)
Custom overrides (acronym/loanword/letter_fallback) are loaded from a
JSON file shaped like the bundled data/zh_en_loanword.json:
from piper_plus_g2p.chinese import ChinesePhonemizer
zh = ChinesePhonemizer(zh_en_loanword_dict_paths="my_overrides.json")
zh.phonemize_embedded_english("MYORG")
PiperEncoder
Converts IPA token lists into integer phoneme_ids for Piper ONNX models.
from piper_plus_g2p.encode import PiperEncoder, get_phoneme_id_map
id_map = get_phoneme_id_map("ja")
encoder = PiperEncoder(id_map)
phoneme_ids = encoder.encode(["k", "o", "[", "N_n", "n", "i", "ch", "i", "w", "a"])
Piper Model Compatibility
piper-plus-g2p produces phoneme tokens directly compatible with
Piper TTS ONNX models. Use
PiperEncoder with the model's phoneme_id_map from config.json:
import json
from piper_plus_g2p import get_phonemizer
from piper_plus_g2p.encode import PiperEncoder
with open("model/config.json") as f:
config = json.load(f)
encoder = PiperEncoder(config["phoneme_id_map"])
phonemizer = get_phonemizer("ja")
tokens = phonemizer.phonemize("こんにちは")
phoneme_ids = encoder.encode(tokens)
# -> ready for ONNX inference
Use strict=True to raise errors on unknown tokens instead of silently
skipping them:
encoder = PiperEncoder(config["phoneme_id_map"], strict=True)
Cross-Platform Consistency
piper-plus-g2p is also available as:
- Rust crate:
piper-plus-g2pon crates.io - Go module:
github.com/ayutaz/piper-plus/src/go/phonemize - npm package:
@piper-plus/g2pfor browser/WASM
All three implementations share the same PUA mapping table and are validated against a common test fixture.
Requirements
- Python >= 3.11
- Language backends are installed via extras (see Supported Languages)
License
MIT
Metadata
Release files for piper-plus-g2p 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| piper_plus_g2p-0.3.0.tar.gz | 221.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| piper_plus_g2p-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 305.7 kB
Release files / piper_plus_g2p-0.3.0.tar.gz
| Download URL | piper_plus_g2p-0.3.0.tar.gz |
|---|---|
| Size | 221.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
90d6d83606fca5ae34f01c2873c57b0d126acfa6b792fb254b0de8340cb8bb01
|
|
BLAKE2b-256 checksum How to use checksums |
f1770b851dc527ee5e0982324e98a553be54fd346b955e97d2b41c5d95739bcb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.
Transparency logRelease files / piper_plus_g2p-0.3.0-py3-none-any.whl
| Download URL | piper_plus_g2p-0.3.0-py3-none-any.whl |
|---|---|
| Size | 84.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b95f7d620ba71f7b1936ece52bcd48e1966976d772a0796641620a2b7891e0e
|
|
BLAKE2b-256 checksum How to use checksums |
df1f2aee040628be1cd61c3c90bbdcf071e85c682f09b12b41e6c5183fec725c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.
Transparency log