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.0a2.tar.gz (19.9 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.0a2-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mwl_phonemizer-1.0.0a2.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

Hashes for mwl_phonemizer-1.0.0a2.tar.gz
Algorithm Hash digest
SHA256 b5dd7e57b635dbbfc99788b174f4a75166c0a6196f78c1eb1b654c36785bd944
MD5 4c1d071a5292de8ebb2c9ccae039be43
BLAKE2b-256 20edc5747541767a629f3c11e8016985cc375467b1844a16731d360225e5b02d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mwl_phonemizer-1.0.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 59e3b9fdf570b8d0fd09e30d8e19c5985cf56580271ce18569f2393f7261fddd
MD5 5efbd3705d4e3ebbc6ec8d5eeff66591
BLAKE2b-256 cccf905ac8dc8eb8d18e655ae7c97a74e3e4e0904b3205c92b92aebb41fc6c51

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