Skip to content

Word boundaries

Thai, Lao, Khmer and Burmese are written without spaces between words. Search, spell-checking, next-word prediction and text-to-speech all need words first. One model handles all four scripts.

ym.segment("ภาษาไทยไม่มีช่องว่างระหว่างคำ", "tha_Thai")
# ['ภาษาไทย', 'ไม่', 'มี', 'ช่องว่าง', 'ระหว่าง', 'คำ']
ym.segment("ຂ້ອຍຮັກພາສາລາວ", "lao_Laoo")

Labels: tha_Thai, lao_Laoo, khm_Khmr, mya_Mymr. Thai keeps any spaces as word breaks; for the other scripts spaces are removed first, as in training.

How good is it

Word F1 on public hand-segmented test sets, against the usual open tool for each language:

Language Test set YellowMIST Open tool
Thai BEST 2010 69.0% 69.3% (PyThaiNLP)
Burmese myPOS 3.0 84.4% 83.1% (pyidaungsu)
Lao HVULao Datatest1k 74.6% 75.1% (LaoNLP)
Khmer ALT test 98.1%
Khmer khPOS 67.5% 92.5% (khmer-nltk)

Khmer follows ALT's word boundaries

Khmer and Burmese were trained on the hand-segmented Asian Language Treebank (CC BY 4.0), which splits Khmer words more finely than khPOS. That is a difference in convention, not an error: a model trained on khPOS-style labels shows the mirror image. Pick the convention your application expects.