Punctuation and capitals¶
Puts back punctuation and capitals in lowercased, unpunctuated text, 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, the Greek question mark (;), and so on.
import yellowmist as ym
ym.punct("e kaaro bawo ni ise ati ebi re", "yor_Latn")
ym.punct("आज मौसम बहुत अच्छा है क्या तुम बाहर चलोगे", "hin_Deva")
await ym.punct("sannu da zuwa yaya aiki", "hau_Latn");
- Any punctuation already in the text is removed first, so the output is the model's own.
- Capitals are restored only for scripts that have them (Latin, Cyrillic, Greek, Armenian).
- Long text is cut into pieces of about 256 characters at spaces.
How good is it¶
Punctuation F1 on held-out web text (a mark counts only if it is the right mark in the right place), against
1-800-BAD-CODE/xlm-roberta_punctuation_fullstop_truecase,
an XLM-RoBERTa model about 18 times larger, on the languages both cover:
| Region | YellowMIST | XLM-R | Gap |
|---|---|---|---|
| West Africa | .607 | .482 | +12.4 |
| South Indic | .666 | .573 | +9.3 |
| North Indic | .633 | .561 | +7.2 |
| Other alphabets | .680 | .612 | +6.8 |
| Americas | .551 | .482 | +6.8 |
| Ethiopic | .593 | .551 | +4.2 |
| Arabic script | .525 | .498 | +2.7 |
| Asia-Pacific | .489 | .482 | +0.7 |
| Central, East & Southern Africa | .533 | .534 | -0.1 |
| Cyrillic | .725 | .729 | -0.4 |
Southeast Asian scripts (no language covered by XLM-R) score .729 mean punctuation F1. Europe is still being trained on more text and will ship in an update.
Capitals are weaker
Capitals F1 is .60 to .79 depending on the region. The test text is web pages, with titles, lists and names in mixed case, and the larger model also falls short on it. Treat capitals as a helpful guess.
Per-language scores are in each model card: olaverse/YellowMIST-Punct-1.0-<REGION>.