semvec/pypi-packages huggingface dataset:
creoleg2p 0.1.0
Haitian Creole grapheme-to-phoneme (G2P) conversion toolkit
License: MIT
Requires Python: >=3.7
Keywords: g2p, phoneme, ipa, haitian-creole, tts, nlp, speech

# CreoleG2P

**CreoleG2P** is a Python package for converting Haitian Creole text to IPA (International Phonetic Alphabet) using either:
- A **trained G2P model** (`.fst` from Phonetisaurus)
- Or a **rule-based grapheme-to-phoneme (G2P) converter**

It supports use cases like **text-to-speech (TTS)**, **speech recognition (STT)**, and linguistic analysis.

## Features

- Predict IPA from Haitian Creole words using a trained G2P model.
- Fallback to a fast, rule-based converter.
- Includes key phoneme and grapheme tables.
- Designed for use in TTS/STT pipelines.

## Installation

Clone the repository and install in editable mode:

```bash
git clone https://github.com/getpredika/creoleg2p.git
cd creoleg2p
pip install -e .
```


## Quick Usage

```python
from creoleg2p import predict, guess_ipa

print(predict("timoun"))                # uses trained FST model
print(predict("timoun", method="rule")) # uses rule-based converter
```

### Access Constants

```python
from creoleg2p import GRAPHEME_TO_PHONEMES, COMMON_PHONEMES

print(GRAPHEME_TO_PHONEMES["an"])  # Output: ã
```

## Generate full lexicon from trained model

```bash
python generate_lexicon_from_fst.py \
  --model models/ht_creole_g2p.fst \
  --input wordlist.txt \
  --output lexicon.dict
```

## Requirements

* Python 3.7+
* [`phonetisaurus`](https://github.com/AdolfVonKleist/Phonetisaurus) installed and on your `$PATH`
* `setuptools` and `pip`