This release is a pre-release and may not be stable for production use.
Mirandese Phonemizer
Grapheme-to-phoneme (G2P) conversion for Mirandese (mwl), the
Asturleonese language of Terra de Miranda, Portugal.
The pipeline has three layers, each falling back to the next:
- Native-speaker gold dictionary — pronunciations from the TigreGotico/mirandese_g2p dataset, bundled as a word list and returned verbatim.
orthography2ipalattice — the language-agnostic orthography2ipa engine with its Mirandese language specs provides the base transcription for any word.- CRF correction — a linear-chain CRF trained on the gold dictionary
corrects the lattice output for out-of-dictionary words. Its features are
orthography2ipa's per-grapheme feature export (phonological-class predicates, grapheme context, candidate-lattice top-1/cost, per-word confidence). Stress placement is delegated to the spec's own stress rules, so the CRF only learns segment corrections.
Quickstart
from mwl_phonemizer import MirandesePhonemizer
pho = MirandesePhonemizer(dialect="mwl")
pho.phonemize("lhéngua") # 'ˈʎɛ̃ɡwɐ'
pho.phonemize("Falo la lhéngua mirandesa.") # full text, punctuation kept
pho.phonemize_word("amportante") # single word
Or the module-level convenience (caches one phonemizer per dialect):
from mwl_phonemizer import phonemize
phonemize("lhéngua")
phonemize("fuogo", dialect="mwl-x-sendim")
MirandesePhonemizer also implements the orthography2ipa G2PPlugin
interface (transcribe, transcribe_word, language_codes).
Dialects
The dialect argument takes an orthography2ipa Mirandese spec code:
| code | variety |
|---|---|
mwl |
Central Mirandese (default) |
mwl-x-sendim |
Sendinese (Sendim) |
mwl-x-ifanes |
Ifanes |
Sendinese gold overrides (e.g. lh → /l/ words) are layered on top of the
base gold dictionary. A small Raiano word list is bundled in
mwl_phonemizer.gold.RAIANO; it is not wired to a dialect because no
mwl-x-raiano spec exists in orthography2ipa.
Accuracy
Phoneme Error Rate (PER = character edit distance / gold length) on the full
205-word native-speaker gold dictionary, dialect mwl, gold lookup disabled
so the numbers reflect the models rather than the dictionary:
| system | PER | PER (stress-agnostic) |
|---|---|---|
orthography2ipa base |
22.33% | 19.60% |
| + CRF, fit to gold | 6.99% | 1.92% |
| + CRF, 5-fold cross-validated | 21.49% | 18.79% |
Methodology, stated honestly:
- fit to gold — the CRF is trained on the full gold dictionary and scored on that same dictionary. This is an upper bound (the deployed default trains exactly this way), not a generalization estimate.
- 5-fold cross-validated — every gold word is scored by a CRF trained without it. This estimates performance on out-of-dictionary words: the CRF helps on both metrics even for words it has never seen, and words that are in the dictionary bypass the model entirely via gold lookup.
- Most residual stressed-PER error is stress-mark placement, which comes from the spec's rule-based stress detector, not from the CRF.
Reproduce with:
python -m mwl_phonemizer.evaluate # dialect mwl
python -m mwl_phonemizer.evaluate mwl-x-sendim
Retraining the CRF
The CRF trains at construction time in a few seconds; there is nothing to ship. To persist and reuse a model:
pho = MirandesePhonemizer(dialect="mwl", crf_model_path="mwl.crf")
The model is loaded from the path when the file exists and trained-then-saved otherwise. To train on custom data:
from orthography2ipa import G2P
from mwl_phonemizer.crf import CRFCorrector
crf = CRFCorrector(G2P("mwl")).train([("lhéngua", "ˈʎɛ̃gwɐ")])
crf.predict("lhéngua")
crf.save("custom.crf")
Install
pip install mwl_phonemizer
License
Apache-2.0
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mwl_phonemizer-1.0.0a1.tar.gz.
File metadata
- Download URL: mwl_phonemizer-1.0.0a1.tar.gz
- Upload date:
- Size: 19.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
420539e75641e12497c010ae085f962ca975bf296b29fae62d55878cbc5602ad
|
|
| MD5 |
95870bf19c7acc227a5249da0ce3b934
|
|
| BLAKE2b-256 |
a0f5035c4dae007348f69b5137a4579f99c845f842c918540fce95b14a3e07d4
|
File details
Details for the file mwl_phonemizer-1.0.0a1-py3-none-any.whl.
File metadata
- Download URL: mwl_phonemizer-1.0.0a1-py3-none-any.whl
- Upload date:
- Size: 17.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd7a2a37bcedd5f1ecc761e3e2a61d7931d9ed6208703ddca3c7d419216bc3e3
|
|
| MD5 |
dfff289dd981fe174f5e278ee1a7fe27
|
|
| BLAKE2b-256 |
d34cba376103fc664d9a9c293732e773b98e2cb551991db8b542054871238d3f
|