
OpenThai2.0-NLP-Core-Lite
All core Thai NLP tasks in one lightweight network, from the OpenThai 2.0 model family. From raw text, it splits sentences and clauses, segments words, tags parts of speech, builds dependency and constituency trees, and finds named entities, on one CPU thread.
- One network instead of a chain of tools: sentences, clauses, words in three units, POS tags (UD, and 37 tags based on the ORCHID tag set), dependency trees (UD), constituency trees (Penn Treebank style) and named entities (the 16 types of ThaiNER). All tasks share one network and read the same words.
- Text without spaces: it finds sentence ends in running Thai text, where spaces are missing, and in speech-like text without punctuation either.
- Lightweight, CPU only: 26.5M parameters in 31 MB of int8 model files. It needs only ONNX Runtime and NumPy, no GPU.
- Fast on a CPU: on one thread, one line per call, about 25,000 characters per second for sentences, 20,000 for POS tags, 18,000 for named entities and 8,900 for dependency trees. That is 14 to 69 times as fast as the best other tool of each task.
- Commercial use: trained only on data whose licences allow commercial use. Model: CC BY-SA 4.0.
Tasks
Four examples, as the model gives them:
| Task | Output |
|---|---|
Words, long |
เจ้าหน้าที่ | การศึกษา | เปิดเผย | ว่า |
Words, short (default) |
เจ้า | หน้าที่ | การ | ศึกษา | เปิด | เผย | ว่า |
Words, minimal |
เจ้า | หน้า | ที่ | การ | ศึกษา | เปิด | เผย | ว่า |
| Sentences | ร้านนี้อาหารอร่อยแต่ราคาค่อนข้างแพง ‖ ครั้งหน้าจะลองสั่งเมนูอื่นดู |
| Clauses | ร้านนี้อาหารอร่อย ‖ แต่ราคาค่อนข้างแพง ‖ ครั้งหน้าจะลองสั่งเมนูอื่นดู |
| POS, UD | นักเรียน NOUN · อ่าน VERB · หนังสือ NOUN · ใน ADP · ห้องสมุด NOUN |
| POS, ORCHID-based | นักเรียน NCMN · อ่าน VTRA · หนังสือ NCMN · ใน RPRE · ห้องสมุด NCMN |
| Dependencies | อ่าน is the root, over นักเรียน (nsubj), หนังสือ (obj) and ห้องสมุด (obl); ใน hangs on ห้องสมุด (case) |
| Constituency | (S (NP (NCMN นักเรียน)) (VP (VTRA อ่าน) (NP (NCMN หนังสือ)) (PP (RPRE ใน) (NP (NCMN ห้องสมุด))))) |
| Named entities | กรมอุตุนิยมวิทยา ORGANIZATION · จังหวัดเชียงใหม่ LOCATION · 3 ธันวาคม 2569 DATE, in กรมอุตุนิยมวิทยาประกาศเตือนฝนตกหนักในจังหวัดเชียงใหม่ตั้งแต่วันที่ 3 ธันวาคม 2569 |
Quick start
pip install "iapp-ai[nlp]"
One call runs every task and returns one document:
from iapp_ai.nlp import core
doc = core.analyze("นักเรียนอ่านหนังสือในห้องสมุด")
for w in doc.sentences[0].words:
print(w.id, w.text, w.upos, w.head, w.deprel)
# 1 นักเรียน NOUN 2 nsubj
# 2 อ่าน VERB 0 root
# 3 หนังสือ NOUN 2 obj
# 4 ใน ADP 5 case
# 5 ห้องสมุด NOUN 2 obl
doc.sentences[0].tree # (S (NP (NCMN นักเรียน)) (VP (VTRA อ่าน) (NP (NCMN หนังสือ)) (PP (RPRE ใน) (NP (NCMN ห้องสมุด)))))
core.analyze("กรมอุตุนิยมวิทยาประกาศเตือนฝนตกหนักในจังหวัดเชียงใหม่", tasks=["ner"]).entities
# [Entity(text='กรมอุตุนิยมวิทยา', label='ORGANIZATION', start=0, end=16),
# Entity(text='จังหวัดเชียงใหม่', label='LOCATION', start=37, end=53)]
Or one function per task:
from iapp_ai.nlp import core
core.tokenize("เจ้าหน้าที่การศึกษาเปิดเผยว่า") # ['เจ้า', 'หน้าที่', 'การ', 'ศึกษา', 'เปิด', 'เผย', 'ว่า']
core.tokenize("เจ้าหน้าที่การศึกษาเปิดเผยว่า", unit="long") # ['เจ้าหน้าที่', 'การศึกษา', 'เปิดเผย', 'ว่า']
core.sent_tokenize("ร้านนี้อาหารอร่อยแต่ราคาค่อนข้างแพงครั้งหน้าจะลองสั่งเมนูอื่นดู")
# ['ร้านนี้อาหารอร่อยแต่ราคาค่อนข้างแพง', 'ครั้งหน้าจะลองสั่งเมนูอื่นดู']
core.pos_tag("นักเรียนอ่านหนังสือในห้องสมุด")
# [('นักเรียน', 'NOUN'), ('อ่าน', 'VERB'), ('หนังสือ', 'NOUN'), ('ใน', 'ADP'), ('ห้องสมุด', 'NOUN')]
pip install "iapp-ai[nlp]" installs NLP Core with iApp's Python package, as iapp_ai.nlp.core. The model
package alone is pip install openthai2.0-nlp-core-lite, with the same functions in openthai_nlp_core_lite. It
holds the model and runs offline on the CPU, with NumPy and ONNX Runtime (Python 3.10 or later).
The same wheel as on PyPI is in this repository too. To install it from here:
pip install -U huggingface_hub
hf download iapp/OpenThai2.0-NLP-Core-Lite openthai2_0_nlp_core_lite-0.2.2-py3-none-any.whl --local-dir .
pip install openthai2_0_nlp_core_lite-0.2.2-py3-none-any.whl
import openthai_nlp_core_lite as nlp_core
nlp_core.pos_tag("นักเรียนอ่านหนังสือในห้องสมุด")
# [('นักเรียน', 'NOUN'), ('อ่าน', 'VERB'), ('หนังสือ', 'NOUN'), ('ใน', 'ADP'), ('ห้องสมุด', 'NOUN')]
Functions
| To get | Call |
|---|---|
| every task at once | analyze(text): one document with its sentences, clauses, words (POS tags, heads, relations), trees and named entities; tasks=["pos", "ner"] for some of them |
| words | tokenize(text), or word_tokenize(text) without the whitespace tokens |
| words of many lines, other readings | tokenize_batch(texts), tokenize_nbest(text, n=3) |
| sentences | sent_tokenize(text), or sent_spans(text) with their offsets |
| clauses | clause_tokenize(text), or clause_spans(text) |
| POS tags | pos_tag(text, tagset="ud"), with "ud" (17 tags) or "orchid" (37 tags based on ORCHID); also on a list of words |
| dependency trees | dependency_parse(text), one tree per sentence |
| constituency trees | constituency_parse(text), one Penn tree per sentence |
| named entities | ner(text): an Entity (text, label, start, end) for each entity, or ner_batch(texts) |
Every task reads the same words. tokenize, tokenize_batch and tokenize_nbest take the arguments of the
OpenThai 2.0 word segmenter. Only what a call needs runs: words
load the word part of the model alone, and pos_tag never loads the parsers.
Options
| To | Use |
|---|---|
| choose the unit | unit="long", "short" (the default) or "minimal" |
| see other readings | tokenize_nbest(text, n=3): the n most probable segmentations, each with its probability |
| read many lines faster | analyze_batch(texts), tokenize_batch(texts), ner_batch(texts), or NLPCore().pipe(lines) for a file |
| save the results | doc.to_dict() for JSON, doc.to_conllu() for CoNLL-U |
| add your own words | NLPCore(extra_words=[...]): names or terms the dictionary lacks (below) |
| use more threads | NLPCore(threads=4) |
| use the command line | openthai-nlp-core-lite --task all < input.txt (one JSON object per line), or --task ner, --format conllu |
Your own words are hints that the model reads, not cuts it must make. They reach every task. In the model
package alone, the argument is user_words:
from iapp_ai.nlp import NLPCore
nlp = NLPCore(extra_words=["ไอโอที", "ดิจิทัลทวิน"])
nlp.tokenize("โรงงานใช้ระบบไอโอทีกับดิจิทัลทวิน", unit="long")
# ['โรงงาน', 'ใช้', 'ระบบ', 'ไอโอที', 'กับ', 'ดิจิทัลทวิน'] (without them: ไอโอ | ที, ดิจิทัล | ทวิน)
In iApp's package
pip install "iapp-ai[nlp]" installs NLP Core with iapp-ai, iApp's Python
package, next to its word segmenter. The two stay apart: iapp_ai.nlp.word_tokenize and the other functions of the
segmenter give its words, and iapp_ai.nlp.core gives the outputs of NLP Core, whose tags and trees read its own
words.
Results
NLP Core against the state-of-the-art (SOTA) system of each task, the best tool from other authors, on raw text. Each system in this table gets what NLP Core gets:
| Task | Score and test data | SOTA system | Size | SOTA | NLP Core | Speed |
|---|---|---|---|---|---|---|
| Sentences | boundary F1, 12 sets | SaT-12l-sm, tuned | 277M | 77.5 | 78.6† | 14× |
| Clauses | boundary F1, 3 treebanks, silver | HoogBERTa | 143M | 30.0* | 70.8 | 25× |
| Words | word F1, 7 sets | SEFR CUT-best | 0.54M | 84.5 | 85.7† | 20× |
| POS tags | UPOS F1, 3 treebanks | Stanza 1.15 accurate | 179M | 73.1 | 74.7† | 69× |
| Dependency trees | LAS F1, 3 treebanks | 259M | 49.8 | 52.8† | 59× | |
| Constituency trees | bracket F1, TUD, silver | 259M | 78.6* | 79.4 | 58× | |
| Named entities | entity F1, ThaiNER | phayathaibert-thainer | 277M | 85.7 | 84.7 | 19× |
- Reading the table
- Bold marks the higher score, and † a lead beyond the 95% interval of a paired bootstrap. A higher score without † is a tie.
- * marks the closest tool where no SOTA system exists. Clauses get no bold, as HoogBERTa cuts another unit.
- Speed: how many times as fast NLP Core runs, on one CPU core and one line per call.
- Size: the number of parameters. The five SOTA systems hold 957M in all, and NLP Core 26.5M.
- Stanza 1.15 accurate serves three rows, so it is named once. It gets constituency trees by converting its dependency trees.
- Test data
- A score over several sets is their mean. The three treebanks are UD Thai-TUD, PUD and TDT.
- The 12 sentence sets are four sets in three forms: as written, without spaces, and speech-like, with neither spaces nor punctuation.
- Silver labels: the clause units and the constituency trees, made by rules from the gold treebank trees and partly checked by hand. All other labels are gold.
- Same input for every system
- Sentences: SaT-12l-sm gets its threshold from the same development sets as NLP Core (74.6 at its default).
- Tags and trees: each system gets one sentence and finds its own words. Stanza runs with its sentence splitter off.
- Named entities: phayathaibert-thainer, like thainer-v2, tags the first piece of each newmm word.
- A closer look
- Sentences: level on text as written. NLP Core leads by 2.0 without spaces and by 1.9 on speech-like text.
- On TUD alone, NLP Core has 83.8 UPOS F1 against 83.1 and 67.2 LAS F1 against 65.5.
- Given the gold words of TUD, it has 92.0 UPOS accuracy against 91.4, 78.8 LAS against 76.3 and 80.2 bracket F1 against 79.6.
- Named entities: phayathaibert-thainer learnt from ThaiNER train, and NLP Core did not. On the 1,385 test texts that share no text with ThaiNER train, the two are level (84.8 against 85.4).
- Where another system leads
- At gold words, Stanza 1.11 accurate tags PUD better (78.4 against 77.8), and Stanza 1.15 default tags TDT better (80.0 against 79.3).
- On the older TUD release of the TUD paper, the models trained on its own split lead.
- Systems trained on a test set are not counted.
- Full results are in OpenThai2.0-NLP-Core-Benchmark, not public yet. Words come from OpenThai2.0-WordSeg-Benchmark 1.0, and named entities from the test split of ThaiNER v2.2, on character spans.
Training data
- Teachers learnt from UD Thai-TUD, scb-mt-en-th-2020, Tatoeba, VISTEC-TP-TH-2021, Wisesight-1000 and the CC BY-SA rows of the khammoon data. The sentence and clause head also learnt the training articles of ALT (NICT, CC BY 4.0).
- Unlabelled text: FineWeb-2, Thai Wikipedia and Wisesight.
- Named entities: our own labels on that text and on Blognone news, written by Qwen3.8-27B (Apache-2.0) and by a teacher trained on them.
- Not used: ThaiNER, BEST, ORCHID, LST20 or other non-commercial data. The training text was filtered against every test set above.
- Sources, licences and attributions: the NOTICE inside the package.
Limitations
- Words: Thai corpora disagree on what a word is. POS follows UD Thai-TUD, which tags many state words VERB where a dictionary has ADJ.
- Parsing reads short words, one sentence at a time. A long paragraph with no sentence end parses slowly.
- Constituency trees have no function tags (-SBJ) and no empty elements. They were learnt from trees converted from TUD dependency trees.
- int8: the last digits can change with the number of threads, or with the other texts of one
ner_batchcall, which can flip a borderline decision. - Named entities follow the 16 types of ThaiNER. Rare types are weak: on ThaiNER test, FACILITY 46.4 and URL 51.7, against PERSON 94.0 and ORGANIZATION 85.6.
Files
chars.int8.onnxandtower.int8.onnx: the shared network.head.*.int8.onnx: one task each, withhead.dep.npzandhead.span.npzfor the two parsers.manifest.json: the labels, the two thresholds and the SHA-256 of every file.- The Python package holds the same files, plus the runtime and the dictionary and character table of the OpenThai 2.0 word segmenter.
- Licences: Apache-2.0 for the code, CC BY-SA 4.0 for the model files, and the Unicode licence for part of the dictionary. Their texts and the NOTICE are inside the package.
Citation
The paper is in preparation. Until it is out, please cite the model as:
@misc{chayintr2026nlpcorelite,
title = {{OpenThai2.0-NLP-Core-Lite}: All Core {Thai} {NLP} Tasks in One Lightweight Network},
author = {Chay-intr, Thodsaporn and Viriyayudhakorn, Kobkrit and Theeramunkong, Thanaruk},
year = {2026},
howpublished = {iApp Technology, Hugging Face},
url = {https://huggingface.co/iapp/OpenThai2.0-NLP-Core-Lite}
}