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 — text in, IPA out, with
cross-word sandhi, allophony and stress.
from mwl_phonemizer import phonemize
phonemize("Falo la lhéngua mirandesa.") # 'ˈfalu lɐ ˈʎɛŋɡwa miɾɐˈndez̺ɐ.'
Install
pip install mwl_phonemizer
This pulls in orthography2ipa,
which carries the Mirandese language specs and gold data.
Usage
One-shot
from mwl_phonemizer import phonemize
phonemize("lhéngua") # 'ˈʎɛŋɡwa'
phonemize("fuogo", dialect="mwl-x-sendim") # Sendinese variety
phonemize caches one phonemizer per dialect, so repeated calls are cheap.
Reusable instance
from mwl_phonemizer import MirandesePhonemizer
pho = MirandesePhonemizer(dialect="mwl")
pho.phonemize("Buonos dies, cumo stás?") # full text, punctuation preserved
pho.phonemize_word("amportante") # a single word -> 'ɐ̃puˈɾtɐ̃tɨ'
transcribe / transcribe_word are aliases of phonemize / phonemize_word,
and language_codes reports the BCP-47 codes the instance covers — the surface
downstream engines call.
Dialects
The dialect argument is an orthography2ipa Mirandese spec code:
| code | variety |
|---|---|
mwl |
Central Mirandese (default) |
mwl-x-sendim |
Sendinese — depalatalises lh/initial l to [l] |
mwl-x-ifanes |
Ifanês / Raiano (northern) |
MirandesePhonemizer("mwl-x-sendim").phonemize("lhobo") # 'ˈloβu', not 'ˈʎobu'
How it works
The transcription is the orthography2ipa Mirandese pronunciation lattice.
That engine owns the phonology — grapheme rules, allophony, cross-word sandhi
and stress — for all three lects. This library is a thin Mirandese-facing
wrapper that adds dialect selection, punctuation-preserving text handling, and
two opt-in layers:
-
Lexicon overlay (
lookup=True) — a bundled native-speaker word dictionary (mwl_phonemizer.gold, from theTigreGotico/mirandese_g2pdataset). Words present in it are returned verbatim. Its transcription convention is finer-grained (marking, for example, vowel centralisation) and differs from the sentence gold below, so it is off by default.pho.phonemize("lhéngua") # 'ˈʎɛŋɡwa' (lattice) pho.phonemize("lhéngua", lookup=True) # 'ˈʎɛ̃ɡwɐ' (dictionary)
-
CRF correction (
use_crf=True) — a linear-chain CRF over the engine's per-grapheme feature export, trained on that same word dictionary. It is tuned to the dictionary's convention and moves output away from the sentence gold, so it too is off by default; it is kept for callers whose target matches that convention.MirandesePhonemizer("mwl", use_crf=True).phonemize_word("amportante")
Accuracy
Phoneme Error Rate (PER = character edit distance / gold length), gold lookup disabled so the numbers reflect the model.
Human gold — the only accuracy measurement (primary)
The only human-authored Mirandese gold is the 219-word native-speaker
dictionary TigreGotico/mirandese_g2p
(central 206, sendinese 11, raiano 2; rows routed to mwl / mwl-x-sendim /
mwl-x-ifanes by their dialect tag). Everything below is scored against it,
full dataset, no caps. Three normalisations are reported:
- strict — only structural markers (syllable dots, optional-phoneme parentheses) removed; stress and every diacritic count.
- folded — additionally folds three documented notation conventions:
stress marks (
ˈ ˌ), length (ː), and tie-bars (t͡ʃ→tʃ). - broad — additionally folds the documented broad-vs-narrow gap: the
human gold is a narrow transcription, this engine is broad-phonemic.
Folds centralised
ʉ ʊ→u, spirantð→d, darkɫ→l, lowerede̞→e, and the apical/laminal sibilant diacritics (s̺ s̻→s). What remains is the residual true phonemic error, not convention distance.
| system | strict | folded | broad |
|---|---|---|---|
| pure lattice (deployed default) | 20.68% | 18.01% | 11.62% |
| + CRF, 5-fold cross-validated (honest OOD) | 21.18% | 18.16% | 12.73% |
| + CRF, fit to dictionary (circular upper bound) | 8.79% | 3.83% | 2.59% |
lexicon lookup (lookup=True, memorisation) |
0.25% | 0.28% | 0.30% |
Reading the table honestly:
- Lexicon lookup ≈ 0% is pure memorisation — the lexicon is this gold, so every word is returned verbatim. It is not an accuracy signal, and it mixes the narrow lexicon convention into otherwise-broad sentences, which is why it is off by default.
- CRF fit-to-dictionary (3.83% folded) is trained and scored on the same words — a circular upper bound, not accuracy.
- CRF 5-fold CV (18.16% folded) is the honest out-of-dictionary estimate. It edges the lattice by ~1.3pp folded, but on the convention-neutral broad basis the gap collapses to 0.37pp (12.73% vs 11.62%): almost all of the CRF's apparent gain is matching the lexicon's narrow convention, not fixing real errors — and it couples every output to that convention. Hence the pure lattice remains the default: convention-neutral, deterministic, untrained, and statistically tied with the CRF on true phonemic error.
Reproduce with:
python -m mwl_phonemizer.evaluate # dialect mwl
python -m mwl_phonemizer.evaluate mwl-x-sendim
Engine sentence set — a consistency check, NOT an accuracy claim
orthography2ipa also ships 20-sentence sets per lect
(mwl/mwl-x-sendim/mwl-x-ifanes). The lattice reproduces them at ~0% PER —
but those sentences were authored to match this engine's own output (they
are engine-pinned), so that 0% is an internal consistency check, not a
measure of accuracy against human ground truth. Earlier versions of this README
(and two downstream dataset cards) presented that 0% as the primary accuracy
figure; that was circular. The human-gold table above is the real measurement.
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-2.0.0a3.tar.gz.
File metadata
- Download URL: mwl_phonemizer-2.0.0a3.tar.gz
- Upload date:
- Size: 24.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fe8e5ca2d638a6e68906fe5d069e2212982a47278d16ef482829bdadd2ca25d
|
|
| MD5 |
cfd19564a5136004846c16fad251fdaa
|
|
| BLAKE2b-256 |
ba008023e9d64c806afc6aa9b8f31f71199244fe0355ff8609419ec6249da388
|
File details
Details for the file mwl_phonemizer-2.0.0a3-py3-none-any.whl.
File metadata
- Download URL: mwl_phonemizer-2.0.0a3-py3-none-any.whl
- Upload date:
- Size: 20.5 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 |
a37f23bf00daeefe57b35e13b81f6d824043bfcee817348672e7e14220aac4b6
|
|
| MD5 |
9aa080e4c3d1d022502bbdd255715144
|
|
| BLAKE2b-256 |
95535a865524996b588d15e8013b99be4ae844f2ac3cebcc124aa9605b74f949
|