File size: 2,115 Bytes
8ad2b23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
library_name: transformers
language: ["khm"]
tags: ["tokenizer", "khmer", "unigram", "sentencepiece", "compact", "efficient"]
---

# πŸ‡°πŸ‡­ Khmer Tokenizer V2 – 18K Vocabulary

A **compact and efficient Khmer tokenizer** designed for use in NLP pipelines such as  
classification, translation, summarization, and text generation.

Trained on diverse Khmer text sources, this tokenizer focuses on **efficiency**,  
**morphological accuracy**, and **perfect reconstruction** during decoding.

---

## Model Details

### Model Description

- **Developed by:** Sok Meas (@Msok99)  
- **Model type:** SentencePiece Unigram Tokenizer  
- **Language(s):** Khmer  
- **License:** MIT  
- **Finetuned from model:** None (trained from scratch)  

### Model Sources

- **Repository:** [https://huggingface.co/Msok99/18k_tokenizer_v2](https://huggingface.co/Msok99/18k_tokenizer_v2)

---

## Uses

### Direct Use
- Tokenization for Khmer NLP models
- Embedding generation
- Text preprocessing for machine learning or fine-tuning tasks

### Downstream Use
- Suitable for use with any Khmer-based LLM, classifier, or translation model
- Can be paired with encoder-decoder architectures (e.g., T5, mBART)

### Out-of-Scope Use
- Not designed for semantic similarity or embedding search directly
- Not a model for language generation by itself

---

## Bias, Risks, and Limitations
- May not perfectly segment highly colloquial or dialectal Khmer
- Some rare archaic terms could be split into smaller subwords
- The tokenizer is purely statistical (no semantic understanding)

### Recommendations
Users fine-tuning Khmer models should ensure corpus cleaning consistency  
and consider domain-specific retraining if using technical or code-mixed datasets.

---

## How to Get Started with the Model

```python
from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("Msok99/18k_tokenizer_v2")
text = "αž€αŸ’αžšαžŸαž½αž„αž’αž”αŸ‹αžšαŸ†αž”αžΆαž“αž…αŸαž‰αžŸαŸαž…αž€αŸ’αžαžΈαž‡αžΌαž“αžŠαŸ†αžŽαžΉαž„αŸ”"
tokens = tokenizer.tokenize(text)
print(tokens)
print(tokenizer.decode(tokenizer.encode(text)))