Skip to main content
Pre-release

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:

  1. Native-speaker gold dictionary — pronunciations from the TigreGotico/mirandese_g2p dataset, bundled as a word list and returned verbatim.
  2. orthography2ipa lattice — the language-agnostic orthography2ipa engine with its Mirandese language specs provides the base transcription for any word.
  3. 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

mwl_phonemizer-1.0.0a3.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mwl_phonemizer-1.0.0a3-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file mwl_phonemizer-1.0.0a3.tar.gz.

File metadata

  • Download URL: mwl_phonemizer-1.0.0a3.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mwl_phonemizer-1.0.0a3.tar.gz
Algorithm Hash digest
SHA256 50f37dbc5c9a58e613686d1d2c2720464f2366e399ef7713983477be25fe495c
MD5 8815cb96a79fdfa0b0e6c3fe2d0e3849
BLAKE2b-256 afa86490976d8049fde4d2f89ba4eb5d13918ade117bb7d2eca84a6bc1787989

See more details on using hashes here.

File details

Details for the file mwl_phonemizer-1.0.0a3-py3-none-any.whl.

File metadata

File hashes

Hashes for mwl_phonemizer-1.0.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 f2228b5d2c1be48ba9f76c85f0192ed8efe7fa0cf5f57284c776e008e5ea5154
MD5 574dd682bae38f21056c0e128984e134
BLAKE2b-256 bb4e3a2c857dc2f4acb4157e189d70a36a7fde890ecaff31e14a7bb01bac71a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page