YellowMIST-Segment-1.0-SEA

YellowMIST-Segment-1.0-SEA

YellowMIST Segment finds word boundaries in Thai, Lao, Khmer and Burmese, which are written without spaces between words. Search, spell-checking, next-word prediction and text-to-speech all need words first. It is a tiny on-device model.

  • Built on olaverse/YellowMIST-Encoder-15M-SEA, a 15M-parameter character encoder, fine-tuned to mark the first character of each word.
  • One model for all four scripts. It accepts text with or without spaces.

Results

Word F1 on public hand-segmented test sets (a word counts only if both its edges are right). The open tool is the usual choice for each language, run on the same sentences.

Language Test set this model open tool
tha_Thai BEST 2010 (train split, used only as a test) 69.0% 69.3% (PyThaiNLP newmm)
khm_Khmr khPOS OPEN-TEST 67.5% 92.5% (khmer-nltk)
mya_Mymr myPOS 3.0 84.4% 83.1% (pyidaungsu)
lao_Laoo HVULao_NLP Datatest1k 74.6% 75.1% (LaoNLP)
khm_Khmr khPOS OPEN-TEST, compounds split into their parts 74.7% –
khm_Khmr ALT held-out test 98.1% –
mya_Mymr ALT held-out test 95.2% –

The test sets are used only as tests; none of their text was used in training, and none is stored here.

Training

  • 4,000 steps of 64 paragraphs.
  • Khmer and Burmese labels are hand-segmented sentences from the Asian Language Treebank (ALT, Riza et al. 2016, CC BY 4.0). No Khmer or Burmese segmentation tool was used.
  • Thai and Lao labels are silver: YellowMIST corpus text segmented by PyThaiNLP (newmm, CC0 dictionary) and LaoNLP.
  • On half of the Lao, Khmer and Burmese examples the spaces are removed, since much real text has none.

Use

With the yellowmist library (recommended)

pip install yellowmist        # or: npm install yellowmist
import yellowmist as ym
ym.segment("ภาษาไทยไม่มีช่องว่างระหว่างคำ", "tha_Thai")      # tha_Thai, lao_Laoo, khm_Khmr, mya_Mymr
import * as ym from "yellowmist";
await ym.segment("ภาษาไทยไม่มีช่องว่างระหว่างคำ", "tha_Thai");
yellowmist segment "ภาษาไทยไม่มีช่องว่างระหว่างคำ" --lang tha_Thai

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.

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-Segment-1.0-SEA", allow_patterns=["onnx.json", "vocab.json", "model.int8.onnx"])
meta = json.load(open(f"{d}/onnx.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, text = "tha_Thai", unicodedata.normalize("NFC", "ภาษาไทยไม่มีช่องว่างระหว่างคำ")   # other scripts: remove spaces first
seq = [ids[f"<|lang:{lang}|>"]] + [ids.get(c, 1) for c in text]
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
starts = sess.run(None, {"ids": x, "mask": m})[0][0, 1:len(seq)].argmax(-1)    # 1 = a word starts here
words, cur = [], ""
for k, ch in enumerate(text):
    if ch == " ":
        words += [cur] if cur else []; cur = ""; continue
    if cur and starts[k] == 1:
        words.append(cur); cur = ""
    cur += ch
print(words + ([cur] if cur else []))

Fine-tune your own

See the fine-tuning notebook (open in Colab) for continuing pretraining on your own text and fine-tuning on the base encoder olaverse/YellowMIST-Encoder-15M-SEA.

More: documentation · GitHub · playground · fine-tuning notebook

Limits

  • Word boundaries in these scripts are partly a convention: test sets disagree with each other, so a few points of F1 are style, not error.
  • Khmer follows ALT's word boundaries, not khPOS's. ALT splits words more finely (3.9 characters per word against 4.65 in khPOS) and writes compound parts as separate words. On khPOS this model scores well below khmer-nltk, which follows khPOS-style boundaries; on ALT's own test it scores 98%. A model trained on khPOS-style labels shows the mirror image (93% on khPOS, 67% on ALT), so neither convention is wrong. Pick the one your application expects.
  • Burmese also follows ALT; it matches pyidaungsu on myPOS and scores 95% on ALT's test.
  • For Thai and Lao the model learned from the open tools' output, so it shares their habits.

Licence

Apache-2.0 for the code and weights.

Training-label sources, all of which allow commercial use:

  • Khmer and Burmese: Asian Language Treebank, CC BY 4.0. Hammam Riza et al., "Introduction of the Asian Language Treebank", O-COCOSDA 2016.
  • Thai: PyThaiNLP words_th.txt dictionary, CC0.
  • Lao: LaoNLP (Apache-2.0) and its word lists: Lao-Dictionary (BSD-style, (c) 2013 Wilson & Campbell), lo_spellcheck_dict from google/language-resources (Apache-2.0), Lao Wiktionary (CC BY-SA 3.0), and the LaoNLP author's own list.

The test sets named above were used only for testing.

Citation

@misc{yellowmist-segment-1.0-sea,
  title  = {YellowMIST-Segment-1.0-SEA: tiny on-device word segmentation for Thai, Lao, Khmer and Burmese},
  author = {Olaverse},
  year   = {2026},
  url    = {https://huggingface.co/olaverse/YellowMIST-Segment-1.0-SEA}
}
Downloads last month
4
Safetensors
Model size
15M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for olaverse/YellowMIST-Segment-1.0-SEA

Finetuned
(3)
this model

Collection including olaverse/YellowMIST-Segment-1.0-SEA