Metadata-Version: 2.4
Name: g2p2
Version: 0.1.2
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Text Processing :: Linguistic
Classifier: License :: OSI Approved :: MIT License
Summary: Zero-dependency grapheme-to-phoneme for the 100 Whisper languages (Rust core)
Keywords: g2p,grapheme-to-phoneme,phonemizer,ipa,whisper,phonetics
Author: jqueguiner
License: MIT OR Apache-2.0
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/jqueguiner/g2p2

# g2p2

Zero-dependency grapheme-to-phoneme for the **100 Whisper languages**, with a
Rust core exposed to Python.

```bash
pip install g2p2
```

```python
from g2p2 import Model

m = Model.load("fr.g2p")
print(m.phonemize("bonjour"))            # bɔ̃ʒuʁ
print(m.phonemize_many(["chat", "eau"])) # ['ʃa', 'o']
```

Model blobs (`*.g2p`) are built from WikiPron / epitran / LLM data — see the
[main repo](https://github.com/jqueguiner/g2p2). Download a language's `.g2p`
from the GitHub releases or build with `cargo run -p xtask -- build-all`.

## API

- `Model.load(path) -> Model` — load a `.g2p` file
- `Model.from_bytes(bytes) -> Model` — load from raw bytes
- `Model.phonemize(word) -> str` — IPA for one word
- `Model.phonemize_many(words) -> list[str]` — IPA for many

License: MIT OR Apache-2.0.

