Datasets:
Tasks:
Token Classification
Modalities:
Text
Formats:
json
Languages:
Thai
Size:
10K - 100K
ArXiv:
License:
|
Download README.md from iapp/OpenThai2.0-WordSeg-Benchmark: direct link, hf CLI and curl.
- Browser
- Download file 9.86 kB
-
https://huggingface.co/datasets/iapp/OpenThai2.0-WordSeg-Benchmark/resolve/main/README.md
- Command line
-
hf download hf://datasets/iapp/OpenThai2.0-WordSeg-Benchmark/README.md
-
curl -L -o README.md https://huggingface.co/datasets/iapp/OpenThai2.0-WordSeg-Benchmark/resolve/main/README.md
9.86 kB
| language: | |
| - th | |
| license: | |
| - cc-by-sa-4.0 | |
| - cc-by-sa-3.0 | |
| - cc0-1.0 | |
| - apache-2.0 | |
| pretty_name: OpenThai2.0 WordSeg Benchmark | |
| task_categories: | |
| - token-classification | |
| tags: | |
| - thai | |
| - word-segmentation | |
| - tokenization | |
| - benchmark | |
| size_categories: | |
| - 10K<n<100K | |
| configs: | |
| - config_name: tud | |
| default: true | |
| data_files: | |
| - split: test | |
| path: data/tud.jsonl | |
| - config_name: pud | |
| data_files: | |
| - split: test | |
| path: data/pud.jsonl | |
| - config_name: ws160 | |
| data_files: | |
| - split: test | |
| path: data/ws160.jsonl | |
| - config_name: vistec | |
| data_files: | |
| - split: test | |
| path: data/vistec.jsonl | |
| # OpenThai2.0-WordSeg-Benchmark | |
| A standard test for Thai word segmentation, version 1.0: seven test sets, one scoring rule, and the results of | |
| twelve systems. It accompanies [the LATTE-WordSeg-Lite paper](https://arxiv.org/abs/2611.21300). | |
| ## Quick start | |
| ```bash | |
| pip install -U huggingface_hub | |
| hf download iapp/OpenThai2.0-WordSeg-Benchmark --repo-type dataset --local-dir wordseg-bench | |
| cd wordseg-bench && pip install -r requirements.txt | |
| ``` | |
| ```python | |
| from benchmark import evaluate | |
| evaluate(my_segmenter, name="my-segmenter") # my_segmenter(text) -> list of words | |
| ``` | |
| This runs your segmenter on the 40,073 lines of the seven test sets. It prints word F1 and boundary F1 on each set | |
| and their averages, next to the published systems, and saves `results-my-segmenter.json`. From the command line: | |
| `python benchmark.py --module my_package:segment`, or `python benchmark.py --predictions my_outputs/` with one | |
| file per set, `SET.jsonl`, holding `{"id": ..., "tokens": [...]}` for each line of `data/SET.jsonl`. | |
| **Why the first run downloads files.** Four test sets are in this repository. The other three (BEST, ORCHID and | |
| khammoon's test) have licences that do not allow sharing them. The first run downloads them from their owners | |
| (about 50 MB), checks them and builds them here, once. | |
| ## Test sets | |
| | Set | Source | Licence | Included | | |
| |---|---|---|---| | |
| | `tud` | [UD Thai-TUD](https://github.com/UniversalDependencies/UD_Thai-TUD), test split | CC BY-SA 4.0 | yes | | |
| | `pud` | [UD Thai-PUD](https://github.com/UniversalDependencies/UD_Thai-PUD) | CC BY-SA 3.0 | yes | | |
| | `ws160` | [Wisesight-160](https://github.com/PyThaiNLP/wisesight-sentiment) | CC0 1.0 | yes | | |
| | `vistec` | [VISTEC-TP-TH-2021](https://github.com/mrpeerat/OSKut), test split | CC BY-SA 3.0 | yes | | |
| | `bestdd` | [BEST 2009](https://huggingface.co/datasets/nectec/best2009), our split | CC BY-NC-SA 3.0 | no | | |
| | `orchidndd` | [ORCHID](https://github.com/wannaphong/corpus_mirror/releases/tag/orchid-v1.0), our split | CC BY-NC-SA 3.0 | no | | |
| | `khm` | [khammoon data](https://huggingface.co/datasets/typhoon-ai/khammoon-data), test split | CC BY-NC 4.0 | no | | |
| How the sets were made from their sources is listed in [NOTICE](https://huggingface.co/datasets/iapp/OpenThai2.0-WordSeg-Benchmark/blob/main/NOTICE) and explained in the paper. | |
| ## Results | |
| Average F1 (%) over the seven test sets: | |
| <!-- results:start --> | |
| | System | Word F1 | Boundary F1 | | |
| |---|---|---| | |
| | **LATTE-WordSeg-Lite** | **85.6** | **93.3** | | |
| | SEFR CUT, `best` | 84.5 | 92.6 | | |
| | DeepCut | 84.5 | 92.6 | | |
| | AttaCut-SC | 84.0 | 92.4 | | |
| | SEFR CUT, `ws1000` | 84.0 | 92.5 | | |
| | AttaCut-C | 83.2 | 91.9 | | |
| | khammoon | 81.8 | 91.3 | | |
| | OSKut, `scads` | 79.4 | 89.9 | | |
| | TLTK | 75.5 | 87.9 | | |
| | OSKut, `ws` | 75.3 | 88.1 | | |
| | PyThaiNLP nlpO3 | 70.9 | 85.6 | | |
| | PyThaiNLP newmm | 70.9 | 85.7 | | |
| <!-- results:end --> | |
| LATTE-WordSeg-Lite with its default unit, `short` (`long`: 83.1 and 92.0, `minimal`: 82.1 and 91.5). khammoon | |
| segments morphemes, not words: six of the seven sets count words, so compare it with `minimal`. Boundary F1 scores | |
| each cut between two characters, so it is higher than word F1 and closer between systems. Both scores on each set are | |
| in `results/expected.json`, and every system's output is in `predictions/`. The model is at | |
| [iapp/OpenThai2.0-LATTE-WordSeg-Lite](https://huggingface.co/iapp/OpenThai2.0-LATTE-WordSeg-Lite) and in the | |
| Python package [iapp-ai](https://pypi.org/project/iapp-ai/). | |
| ## How scores are computed | |
| - **Word F1:** a word is correct when a gold word has the same start and end. **Boundary F1:** a cut between two | |
| characters is correct when gold cuts there too. A space always separates words and is never scored: a token | |
| that holds a space counts as the words between its spaces. | |
| - Every system gets the same lines and the same rule, so its numbers can be compared with the table above. | |
| ## Data format | |
| Each line of `data/SET.jsonl` is one test line, with the start and end of every gold word: | |
| ```json | |
| {"id": 0, "text": "ยุ้ยจะบอกว่ามันนานแล้ว แต่เรารักกัน", "gold": [[0, 4], [4, 6], [6, 9], [9, 12], [12, 15], [15, 18], [18, 22], [23, 26], [26, 29], [29, 32], [32, 35]]} | |
| ``` | |
| The four included sets also load with `datasets`: `load_dataset("iapp/OpenThai2.0-WordSeg-Benchmark", "tud")`. | |
| ## Reproduce the paper | |
| ```bash | |
| python fetch_sources.py # every original file at its pinned revision, SHA-256 checked | |
| python build_testsets.py # every test file, checked against checksums.json | |
| python score.py table # every score of the paper, checked against results/expected.json | |
| ``` | |
| ## Licences | |
| - **Test files:** the licence of their source (table above). Files built from a CC BY-SA corpus are shared under | |
| the same licence. [NOTICE](https://huggingface.co/datasets/iapp/OpenThai2.0-WordSeg-Benchmark/blob/main/NOTICE) gives the attribution of each source. | |
| - **Code** (`*.py`): Apache-2.0 ([LICENSE](https://huggingface.co/datasets/iapp/OpenThai2.0-WordSeg-Benchmark/blob/main/LICENSE)). | |
| - **Predictions:** the word offsets contain no text; the token files of the four included sets contain their | |
| text, under its licence. | |
| ## Citation | |
| If you use the benchmark, please cite the paper and the source of each test set you use. | |
| ```bibtex | |
| @misc{chayintr2026lattewordseglite, | |
| title = {{LATTE-WordSeg-Lite}: Multi-Granularity {Thai} Word Segmentation on a {CPU}, with a Reproducible Benchmark}, | |
| author = {Chay-intr, Thodsaporn and Viriyayudhakorn, Kobkrit and Theeramunkong, Thanaruk}, | |
| year = {2026}, | |
| eprint = {2611.21300}, | |
| archivePrefix = {arXiv}, | |
| primaryClass = {cs.CL}, | |
| url = {https://arxiv.org/abs/2611.21300} | |
| } | |
| ``` | |
| <details> | |
| <summary>BibTeX of the sources</summary> | |
| ```bibtex | |
| @article{sriwirote2025tud, | |
| title = {The {Thai} {Universal} {Dependency} Treebank}, | |
| author = {Sriwirote, Panyut and Leong, Wei Qi and Polpanumas, Charin and Thanyawong, Santhawat and Tjhi, William Chandra and Aroonmanakun, Wirote and Rutherford, Attapol T.}, | |
| journal = {Transactions of the Association for Computational Linguistics}, | |
| volume = {13}, | |
| pages = {376--391}, | |
| year = {2025}, | |
| doi = {10.1162/tacl_a_00745} | |
| } | |
| @inproceedings{zeman2017conll, | |
| title = {{CoNLL} 2017 Shared Task: Multilingual Parsing from Raw Text to {Universal Dependencies}}, | |
| author = {Zeman, Daniel and others}, | |
| booktitle = {Proceedings of the {CoNLL} 2017 Shared Task: Multilingual Parsing from Raw Text to {Universal Dependencies}}, | |
| pages = {1--19}, | |
| year = {2017} | |
| } | |
| @misc{suriyawongkul2024wisesight, | |
| title = {{PyThaiNLP/Wisesight} Sentiment Corpus with Word Tokenization Label}, | |
| author = {Suriyawongkul, Arthit and Chuangsuwanich, Ekapol and Chormai, Pattarawat and Chantarapratin, Nitchakarn and Prasertsom, Ponrawee and Sawatphol, Jitkapat and Yamada, Nozomi and Rutherford, Attapol and Polpanumas, Charin and Udomcharoenchaikit, Can}, | |
| publisher = {Zenodo}, | |
| note = {Version 1.1}, | |
| doi = {10.5281/zenodo.3457446}, | |
| year = {2024} | |
| } | |
| @inproceedings{limkonchotiwat2021oskut, | |
| title = {Handling Cross- and Out-of-Domain Samples in {Thai} Word Segmentation}, | |
| author = {Limkonchotiwat, Peerat and Phatthiyaphaibun, Wannaphong and Sarwar, Raheem and Chuangsuwanich, Ekapol and Nutanong, Sarana}, | |
| booktitle = {Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021}, | |
| pages = {1003--1016}, | |
| year = {2021} | |
| } | |
| @inproceedings{kosawat2009best, | |
| title = {{BEST} 2009: {Thai} Word Segmentation Software Contest}, | |
| author = {Kosawat, Krit and Boriboon, Monthika and Chootrakool, Patcharika and Chotimongkol, Ananlada and Klaithin, Supon and Kongyoung, Sarawoot and Kriengket, Kanyanut and Phaholphinyo, Sitthaa and Purodakananda, Sumonmas and Thanakulwarapas, Tipraporn and Wutiwiwatchai, Chai}, | |
| booktitle = {Eighth International Symposium on Natural Language Processing}, | |
| pages = {83--88}, | |
| year = {2009} | |
| } | |
| @article{sornlertlamvanich1999orchid, | |
| title = {Building a {Thai} Part-of-Speech Tagged Corpus ({ORCHID})}, | |
| author = {Sornlertlamvanich, Virach and Takahashi, Naoto and Isahara, Hitoshi}, | |
| journal = {Journal of the Acoustical Society of Japan (E)}, | |
| volume = {20}, | |
| number = {3}, | |
| pages = {189--198}, | |
| year = {1999}, | |
| doi = {10.1250/ast.20.189} | |
| } | |
| @article{khammoon2026, | |
| title = {khammoon: From a Linguistic Guideline to a {Thai} Morpheme Segmenter}, | |
| author = {Sirichotedumrong, Warit and Na-Thalang, Adisai and Wittayasakpan, Chanakan and Phatcharoen, Kritsadha and Pipatanakul, Kunat}, | |
| journal = {arXiv preprint arXiv:2611.13012}, | |
| year = {2026} | |
| } | |
| @inproceedings{limkonchotiwat2025wangchan, | |
| title = {{WangchanThaiInstruct}: An Instruction-Following Dataset for Culture-Aware, Multitask, and Multi-domain Evaluation in {Thai}}, | |
| author = {Limkonchotiwat, Peerat and Tuchinda, Pume and Lowphansirikul, Lalita and Nonesung, Surapon and Tasawong, Panuthep and Aji, Alham Fikri and Udomcharoenchaikit, Can and Nutanong, Sarana}, | |
| booktitle = {Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing}, | |
| pages = {3535--3558}, | |
| year = {2025} | |
| } | |
| ``` | |
| </details> | |