Omarrran commited on
Commit
d0a9fe5
·
verified ·
1 Parent(s): 82745ea

Initial commit: KashTok tokenizer

Browse files
Files changed (4) hide show
  1. README.md +93 -0
  2. special_tokens_map.json +7 -0
  3. tokenizer.json +229 -0
  4. tokenizer_config.json +10 -0
README.md ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ks
4
+ - kas
5
+ license: apache-2.0
6
+ tags:
7
+ - tokenizer
8
+ - kashmiri
9
+ - low-resource
10
+ - perso-arabic
11
+ - character
12
+ library_name: transformers
13
+ ---
14
+
15
+ # Character Tokenizer for Kashmiri
16
+
17
+ A Character tokenizer for Kashmiri (ISO 639-3: `kas`) trained on
18
+ **KS-LIT-3M**, a 3.1M-word literary corpus. Released as part of the
19
+ **KashTok** study (Malik et al., 2026), the first systematic
20
+ linguist-verified tokenization comparison for Kashmiri.
21
+
22
+ ## Quick Start
23
+
24
+ ```python
25
+ from transformers import AutoTokenizer
26
+ tokenizer = AutoTokenizer.from_pretrained("Omarrran/Kashmiri_Char_Tokenizer")
27
+
28
+ text = "کٲشِر زَبان چھِیہٕ خٲص زَبان"
29
+ encoding = tokenizer(text, return_tensors="pt")
30
+ print(tokenizer.tokenize(text))
31
+ print(encoding.input_ids)
32
+ ```
33
+
34
+ ## Model Details
35
+
36
+ | Property | Value |
37
+ |---|---|
38
+ | Tokenizer type | Character |
39
+ | Vocabulary size | 133 |
40
+ | Training corpus | KS-LIT-3M (2.47M words, 129,672 train segments) |
41
+ | Special tokens | `[PAD]` `[UNK]` `[CLS]` `[SEP]` `[MASK]` |
42
+ | Max sequence length | 512 |
43
+ | Pre-tokenization | NFC + KS_CHAR_MAP normalization |
44
+
45
+ ## Evaluation Metrics
46
+
47
+ Computed on **16,209 truly-unseen** held-out test segments from KS-LIT-3M:
48
+
49
+ | Metric | Value |
50
+ |---|---|
51
+ | Composite Quality Score (CQS) | 0.3107 |
52
+ | Fertility (↓ better) | 5.2453 |
53
+ | Diacritic Preservation Score (↑) | 0.0000 |
54
+ | Morphological Boundary Alignment (↑) | 0.2104 |
55
+ | Out-of-Vocabulary rate (↓) | 0.0000 |
56
+ | Reconstruction (char-level, ↑) | N/A |
57
+
58
+ See [the paper](https://arxiv.org/) for full evaluation methodology and
59
+ the linguist-verified gold morpheme reference.
60
+
61
+ ## Recommended Use
62
+
63
+ **Primary use case:** ASR/OCR post-correction, character-level models, error analysis
64
+
65
+ 133 vocab — one token per Unicode codepoint. Fertility 5.25.
66
+
67
+ ## Companion Repositories
68
+
69
+ The other four KashTok tokenizers are also available for direct comparison:
70
+
71
+ - [Kashmiri_Char_Tokenizer](https://huggingface.co/Omarrran/Kashmiri_Char_Tokenizer)
72
+ - [Kashmiri_Word_Tokenizer](https://huggingface.co/Omarrran/Kashmiri_Word_Tokenizer)
73
+ - [Kashmiri_WordPiece_Tokenizer](https://huggingface.co/Omarrran/Kashmiri_WordPiece_Tokenizer)
74
+ - [Kashmiri_BPE_Tokenizer](https://huggingface.co/Omarrran/Kashmiri_BPE_Tokenizer)
75
+ - [Kashmiri_Unigram_Tokenizer](https://huggingface.co/Omarrran/Kashmiri_Unigram_Tokenizer)
76
+
77
+ ## Citation
78
+
79
+ ```bibtex
80
+ @article{malik2026kashtok,
81
+ title = {KashTok: Tokenizing Kashmiri at Scale with Novel
82
+ Diacritic- and Morphology-Aware Metrics},
83
+ author = {Malik, Haq Nawaz and Nissar, Nahfid and others},
84
+ year = {2026}
85
+ }
86
+ ```
87
+
88
+ ## Linguistic Verification
89
+
90
+ Every Kashmiri character, diacritic, and morpheme split used in the
91
+ evaluation of this tokenizer was confirmed by a native-Kashmiri-speaker
92
+ linguistic review (40 consonants, 7 vowels, 11 diacritics, 26 gold
93
+ morpheme splits).
special_tokens_map.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "pad_token": "[PAD]",
3
+ "unk_token": "[UNK]",
4
+ "cls_token": "[CLS]",
5
+ "sep_token": "[SEP]",
6
+ "mask_token": "[MASK]"
7
+ }
tokenizer.json ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "1.0",
3
+ "truncation": null,
4
+ "padding": null,
5
+ "added_tokens": [
6
+ {
7
+ "id": 0,
8
+ "content": "[PAD]",
9
+ "single_word": false,
10
+ "lstrip": false,
11
+ "rstrip": false,
12
+ "normalized": false,
13
+ "special": true
14
+ },
15
+ {
16
+ "id": 1,
17
+ "content": "[UNK]",
18
+ "single_word": false,
19
+ "lstrip": false,
20
+ "rstrip": false,
21
+ "normalized": false,
22
+ "special": true
23
+ },
24
+ {
25
+ "id": 2,
26
+ "content": "[CLS]",
27
+ "single_word": false,
28
+ "lstrip": false,
29
+ "rstrip": false,
30
+ "normalized": false,
31
+ "special": true
32
+ },
33
+ {
34
+ "id": 3,
35
+ "content": "[SEP]",
36
+ "single_word": false,
37
+ "lstrip": false,
38
+ "rstrip": false,
39
+ "normalized": false,
40
+ "special": true
41
+ },
42
+ {
43
+ "id": 4,
44
+ "content": "[MASK]",
45
+ "single_word": false,
46
+ "lstrip": false,
47
+ "rstrip": false,
48
+ "normalized": false,
49
+ "special": true
50
+ }
51
+ ],
52
+ "normalizer": {
53
+ "type": "NFC"
54
+ },
55
+ "pre_tokenizer": {
56
+ "type": "Split",
57
+ "pattern": {
58
+ "String": ""
59
+ },
60
+ "behavior": "Isolated",
61
+ "invert": false
62
+ },
63
+ "post_processor": {
64
+ "type": "TemplateProcessing",
65
+ "single": [
66
+ {
67
+ "Sequence": {
68
+ "id": "A",
69
+ "type_id": 0
70
+ }
71
+ }
72
+ ],
73
+ "pair": [
74
+ {
75
+ "Sequence": {
76
+ "id": "A",
77
+ "type_id": 0
78
+ }
79
+ },
80
+ {
81
+ "Sequence": {
82
+ "id": "B",
83
+ "type_id": 1
84
+ }
85
+ }
86
+ ],
87
+ "special_tokens": {}
88
+ },
89
+ "decoder": null,
90
+ "model": {
91
+ "type": "WordLevel",
92
+ "vocab": {
93
+ "[PAD]": 0,
94
+ "[UNK]": 1,
95
+ "[CLS]": 2,
96
+ "[SEP]": 3,
97
+ "[MASK]": 4,
98
+ "[BOS]": 5,
99
+ "[EOS]": 6,
100
+ "\n": 7,
101
+ " ": 8,
102
+ "!": 9,
103
+ "\"": 10,
104
+ "'": 11,
105
+ "-": 12,
106
+ ".": 13,
107
+ "«": 14,
108
+ "»": 15,
109
+ "؁": 16,
110
+ "،": 17,
111
+ "؎": 18,
112
+ "ؐ": 19,
113
+ "ؑ": 20,
114
+ "ؒ": 21,
115
+ "ؓ": 22,
116
+ "ؔ": 23,
117
+ "؛": 24,
118
+ "؟": 25,
119
+ "ؠ": 26,
120
+ "ء": 27,
121
+ "آ": 28,
122
+ "أ": 29,
123
+ "ؤ": 30,
124
+ "إ": 31,
125
+ "ئ": 32,
126
+ "ا": 33,
127
+ "ب": 34,
128
+ "ت": 35,
129
+ "ث": 36,
130
+ "ج": 37,
131
+ "ح": 38,
132
+ "خ": 39,
133
+ "د": 40,
134
+ "ذ": 41,
135
+ "ر": 42,
136
+ "ز": 43,
137
+ "س": 44,
138
+ "ش": 45,
139
+ "ص": 46,
140
+ "ض": 47,
141
+ "ط": 48,
142
+ "ظ": 49,
143
+ "ع": 50,
144
+ "غ": 51,
145
+ "ف": 52,
146
+ "ق": 53,
147
+ "ك": 54,
148
+ "ل": 55,
149
+ "م": 56,
150
+ "ن": 57,
151
+ "ه": 58,
152
+ "و": 59,
153
+ "ً": 60,
154
+ "ٍ": 61,
155
+ "َ": 62,
156
+ "ُ": 63,
157
+ "ِ": 64,
158
+ "ّ": 65,
159
+ "ْ": 66,
160
+ "ٓ": 67,
161
+ "ٔ": 68,
162
+ "ٕ": 69,
163
+ "ٖ": 70,
164
+ "ٗ": 71,
165
+ "٘": 72,
166
+ "ٚ": 73,
167
+ "ٛ": 74,
168
+ "ٟ": 75,
169
+ "٠": 76,
170
+ "١": 77,
171
+ "٢": 78,
172
+ "٣": 79,
173
+ "٤": 80,
174
+ "٥": 81,
175
+ "٦": 82,
176
+ "٧": 83,
177
+ "٨": 84,
178
+ "٩": 85,
179
+ "٪": 86,
180
+ "٭": 87,
181
+ "ٮ": 88,
182
+ "ٮ۪": 89,
183
+ "ٰ": 90,
184
+ "ٲ": 91,
185
+ "ٳ": 92,
186
+ "ٹ": 93,
187
+ "پ": 94,
188
+ "ٿ": 95,
189
+ "ڀ": 96,
190
+ "چ": 97,
191
+ "ڈ": 98,
192
+ "ڑ": 99,
193
+ "ژ": 100,
194
+ "ڙ": 101,
195
+ "ک": 102,
196
+ "ڪ": 103,
197
+ "ڮ": 104,
198
+ "گ": 105,
199
+ "ں": 106,
200
+ "ھ": 107,
201
+ "ہ": 108,
202
+ "ۂ": 109,
203
+ "ۃ": 110,
204
+ "ۄ": 111,
205
+ "ۅ": 112,
206
+ "ۆ": 113,
207
+ "ی": 114,
208
+ "ۍ": 115,
209
+ "ے": 116,
210
+ "ۓ": 117,
211
+ "۔": 118,
212
+ "۪": 119,
213
+ "ۭ": 120,
214
+ "۰": 121,
215
+ "۱": 122,
216
+ "۲": 123,
217
+ "۳": 124,
218
+ "۴": 125,
219
+ "۵": 126,
220
+ "۶": 127,
221
+ "۷": 128,
222
+ "۸": 129,
223
+ "۹": 130,
224
+ "﴾": 131,
225
+ "﴿": 132
226
+ },
227
+ "unk_token": "[UNK]"
228
+ }
229
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "cls_token": "[CLS]",
4
+ "mask_token": "[MASK]",
5
+ "model_max_length": 512,
6
+ "pad_token": "[PAD]",
7
+ "sep_token": "[SEP]",
8
+ "tokenizer_class": "TokenizersBackend",
9
+ "unk_token": "[UNK]"
10
+ }