YellowMIST-Punct-1.0-ESA
YellowMIST Punct puts back the punctuation and capitals in text that has none, such as speech-to-text output or quick chat messages. It writes each language's own marks: the danda (।) for Hindi, ። and ፣ for Amharic, ، and ؟ for Arabic script, and so on. It is a tiny on-device model, one per script or region group. This one covers Central, East and Southern Africa (Latin script): 30 languages tested.
- Built on
olaverse/YellowMIST-Encoder-15M-ESA, a 15M-parameter character encoder, with two small heads: the punctuation mark after each character (none, full stop, comma, question mark, exclamation mark), and whether the character is a capital. - It reads characters, so unusual spellings and missing tone marks do not break a tokenizer.
Results
Held-out web documents from the YellowMIST corpus, never used in training. The input is the text lowercased with its punctuation removed; the model has to put both back. Punctuation F1 counts a mark as right only if it is the right mark in the right place.
- Mean punctuation F1: 54.2%
- Mean capitals F1: 71.0%
Against a large multilingual model
The same held-out text, on the languages both models cover, against
1-800-BAD-CODE/xlm-roberta_punctuation_fullstop_truecase,
an XLM-RoBERTa model about 18 times larger.
| Language | this model, punctuation | XLM-R, punctuation | this model, capitals | XLM-R, capitals |
|---|---|---|---|---|
afr_Latn |
76.5% | 65.4% | 90.9% | 85.3% |
eng_Latn |
74.9% | 48.2% | 91.4% | 74.8% |
kin_Latn |
60.5% | 44.0% | 88.4% | 78.8% |
som_Latn |
70.4% | 53.9% | 81.5% | 79.0% |
swh_Latn |
61.5% | 55.3% | 81.8% | 75.6% |
Every language tested
| Language | punctuation F1 | capitals F1 | marks in test |
|---|---|---|---|
afr_Latn |
76.7% | 91.9% | 1698 |
eng_Latn |
72.3% | 91.7% | 1663 |
nya_Latn |
48.4% | 84.3% | 1422 |
plt_Latn |
66.4% | 79.9% | 1410 |
sot_Latn |
55.2% | 77.1% | 1394 |
lin_Latn |
46.3% | 79.5% | 1344 |
kin_Latn |
62.2% | 89.7% | 1325 |
lug_Latn |
57.8% | 85.4% | 1256 |
xho_Latn |
53.3% | 66.3% | 1215 |
swh_Latn |
63.7% | 84.1% | 1188 |
gaz_Latn |
72.2% | 88.5% | 1166 |
zul_Latn |
52.2% | 69.8% | 1159 |
tso_Latn |
48.6% | 70.1% | 1070 |
sna_Latn |
58.2% | 85.1% | 1046 |
som_Latn |
70.9% | 81.9% | 1026 |
run_Latn |
52.0% | 78.0% | 1005 |
nso_Latn |
53.9% | 30.1% | 1002 |
tsn_Latn |
61.2% | 66.0% | 768 |
luo_Latn |
26.8% | 48.2% | 728 |
crs_Latn |
44.9% | 71.5% | 551 |
dik_Latn |
52.6% | 49.8% | 496 |
ven_Latn |
65.7% | 53.8% | 480 |
nbl_Latn |
59.3% | 62.6% | 415 |
ssw_Latn |
71.2% | 61.1% | 392 |
nde_Latn |
52.4% | 80.0% | 247 |
mfe_Latn |
40.5% | 66.1% | 233 |
rcf_Latn |
20.5% | 43.1% | 168 |
dov_Latn |
38.5% | 57.0% | 104 |
nyn_Latn |
30.8% | 72.7% | 45 |
ndc_Latn |
52.5% | 64.0% | 42 |
Training
- 40,000 steps of 64 pieces of up to 256 characters from the YellowMIST corpus (about 20M characters per language), with the punctuation removed and the text lowercased.
- Languages are drawn in proportion to the size of their text (to the power 0.3).
;and:are learnt as commas (except the Greek question mark). Quotes, brackets and dashes are left as they are.
Use
With the yellowmist library (recommended)
pip install yellowmist # or: npm install yellowmist
import yellowmist as ym
ym.punct("your text without punctuation or capitals", "swh_Latn")
import * as ym from "yellowmist";
await ym.punct("your text without punctuation or capitals", "swh_Latn");
yellowmist punct "your text" --lang swh_Latn
The library downloads this model the first time it is needed, picks the right region for each language, and runs it with ONNX Runtime on the CPU. Output is the text with this language's own punctuation marks and, where the script has them, capitals.
Without the library (ONNX Runtime)
import json, unicodedata, numpy as np, onnxruntime as ort
from huggingface_hub import snapshot_download
d = snapshot_download("olaverse/YellowMIST-Punct-1.0-ESA", allow_patterns=["onnx.json", "vocab.json", "punct.json", "model.int8.onnx"])
meta, pj = json.load(open(f"{d}/onnx.json")), json.load(open(f"{d}/punct.json"))
ids = {t: i for i, t in enumerate(json.load(open(f"{d}/vocab.json"))["vocab"])}
sess = ort.InferenceSession(f"{d}/model.int8.onnx")
lang = "swh_Latn"
names = ["none", "period", "comma", "question", "exclaim"]
glyph = {1: ".", 2: ",", 3: "?", 4: "!"} # this language's own marks override these
glyph.update({(int(k) if str(k).isdigit() else names.index(k)): v for k, v in pj.get("glyphs", {}).get(lang, {}).items()})
cased = lang in pj.get("cased", [])
text = unicodedata.normalize("NFC", "your text without punctuation or capitals").lower() # up to 255 characters
seq = [ids[f"<|lang:{lang}|>"]] + [ids.get(c, 1) for c in text] # 1 = <unk>
x = np.zeros((1, meta["length"]), np.int64); m = np.zeros((1, meta["length"]), np.float32)
x[0, :len(seq)] = seq; m[0, :len(seq)] = 1
p, c = (o[0, 1:len(seq)].argmax(-1) for o in sess.run(None, {"ids": x, "mask": m}))
print("".join((ch.upper() if cased and c[k] == 1 else ch) + (glyph[int(p[k])] if p[k] else "") for k, ch in enumerate(text)))
Longer text: cut it at spaces into pieces of at most 255 characters. The library also settles capitals word by word.
Fine-tune your own
The fine-tuning notebook (open in Colab) walks through continuing pretraining on your own text, fine-tuning a task, exporting to ONNX and sharing it. In short:
from yellowmist import train
import yellowmist as ym
enc = train.Encoder.load("ESA") # this region's base encoder
model = train.finetune_punct(enc, {"swh_Latn": paragraphs}) # your own punctuated text
model.save("my-model") # weights + ONNX, ready for the library
ym.register("punct", "my-model") # your model now serves its languages
pip install "yellowmist[train]" for training (PyTorch and Dew).
More: documentation · GitHub · playground · fine-tuning notebook
Limits
- Capitals are weaker than punctuation. Mean capitals F1 is 71.0% on this test, below our 85% target. The test text is web pages, with titles, lists and names in mixed case, and the larger model also falls short of the target on it. Treat capitals as a helpful guess.
- The scores are on written web text. Speech transcripts and chat are punctuated differently; expect some drop.
- Long text is cut into pieces of about 256 characters at spaces, so a mark right at a cut can be missed.
Licence
Apache-2.0.
Citation
@misc{yellowmist-punct-1.0-esa,
title = {YellowMIST-Punct-1.0-ESA: tiny on-device punctuation and capitals restoration},
author = {Olaverse},
year = {2026},
url = {https://huggingface.co/olaverse/YellowMIST-Punct-1.0-ESA}
}
- Downloads last month
- -
Model tree for olaverse/YellowMIST-Punct-1.0-ESA
Base model
olaverse/YellowMIST-Encoder-15M-ESA