hafeez007 commited on
Commit
958fa32
·
verified ·
1 Parent(s): 3cfa585

Add Balochi SentencePiece BPE tokenizer

Browse files
Files changed (3) hide show
  1. README.md +40 -0
  2. tokenizer.json +209 -0
  3. tokenizer_config.json +20 -0
README.md ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - bal
4
+ license: apache-2.0
5
+ tags:
6
+ - balochi
7
+ - tokenizer
8
+ - sentencepiece
9
+ - bpe
10
+ - perso-arabic
11
+ - low-resource-nlp
12
+ ---
13
+
14
+ # Balochi SentencePiece BPE Tokenizer
15
+
16
+ SentencePiece BPE tokenizer trained on the Mozilla Balochi Dataset.
17
+ Designed for Balochi written in Perso-Arabic script.
18
+
19
+ ## Character Inventory
20
+ - 38 standard Balochi letters (exact Unicode codepoints)
21
+ - 6 atomic special sequences: ۓ یے ئے ءُ ءِ ءَ
22
+ - Meaningful diacritics preserved: Fatha (ـَ) Damma (ـُ) Kasra (ـِ) Shadda (ـّ)
23
+ - byte_fallback=True — zero [UNK] tokens guaranteed
24
+
25
+ ## Usage
26
+ ```python
27
+ from transformers import AutoTokenizer
28
+ tok = AutoTokenizer.from_pretrained("YOUR_USERNAME/balochi-tokenizer")
29
+ tokens = tok.tokenize("دبستانانی وانشتءَ پیسر")
30
+ print(tokens)
31
+ ```
32
+
33
+ ## Special Tokens
34
+ | Token | ID |
35
+ |---|---|
36
+ | [PAD] | 0 |
37
+ | [UNK] | 1 |
38
+ | [CLS] | 2 |
39
+ | [SEP] | 3 |
40
+ | [MASK] | 4 |
tokenizer.json ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "1.0",
3
+ "truncation": null,
4
+ "padding": null,
5
+ "added_tokens": [
6
+ {
7
+ "id": 0,
8
+ "content": "<s>",
9
+ "single_word": false,
10
+ "lstrip": false,
11
+ "rstrip": false,
12
+ "normalized": false,
13
+ "special": true
14
+ },
15
+ {
16
+ "id": 1,
17
+ "content": "[PAD]",
18
+ "single_word": false,
19
+ "lstrip": false,
20
+ "rstrip": false,
21
+ "normalized": false,
22
+ "special": true
23
+ },
24
+ {
25
+ "id": 2,
26
+ "content": "</s>",
27
+ "single_word": false,
28
+ "lstrip": false,
29
+ "rstrip": false,
30
+ "normalized": false,
31
+ "special": true
32
+ },
33
+ {
34
+ "id": 3,
35
+ "content": "[UNK]",
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
+ "id": 5,
53
+ "content": "[SEP]",
54
+ "single_word": false,
55
+ "lstrip": false,
56
+ "rstrip": false,
57
+ "normalized": false,
58
+ "special": true
59
+ },
60
+ {
61
+ "id": 6,
62
+ "content": "[CLS]",
63
+ "single_word": false,
64
+ "lstrip": false,
65
+ "rstrip": false,
66
+ "normalized": false,
67
+ "special": true
68
+ }
69
+ ],
70
+ "normalizer": {
71
+ "type": "Sequence",
72
+ "normalizers": [
73
+ {
74
+ "type": "Strip",
75
+ "strip_left": false,
76
+ "strip_right": true
77
+ },
78
+ {
79
+ "type": "Replace",
80
+ "pattern": {
81
+ "String": " {2,}"
82
+ },
83
+ "content": "▁"
84
+ }
85
+ ]
86
+ },
87
+ "pre_tokenizer": {
88
+ "type": "Sequence",
89
+ "pretokenizers": [
90
+ {
91
+ "type": "WhitespaceSplit"
92
+ },
93
+ {
94
+ "type": "Metaspace",
95
+ "replacement": "▁",
96
+ "prepend_scheme": "always",
97
+ "split": true
98
+ }
99
+ ]
100
+ },
101
+ "post_processor": {
102
+ "type": "TemplateProcessing",
103
+ "single": [
104
+ {
105
+ "SpecialToken": {
106
+ "id": "<s>",
107
+ "type_id": 0
108
+ }
109
+ },
110
+ {
111
+ "Sequence": {
112
+ "id": "A",
113
+ "type_id": 0
114
+ }
115
+ },
116
+ {
117
+ "SpecialToken": {
118
+ "id": "</s>",
119
+ "type_id": 0
120
+ }
121
+ }
122
+ ],
123
+ "pair": [
124
+ {
125
+ "SpecialToken": {
126
+ "id": "<s>",
127
+ "type_id": 0
128
+ }
129
+ },
130
+ {
131
+ "Sequence": {
132
+ "id": "A",
133
+ "type_id": 0
134
+ }
135
+ },
136
+ {
137
+ "SpecialToken": {
138
+ "id": "</s>",
139
+ "type_id": 0
140
+ }
141
+ },
142
+ {
143
+ "Sequence": {
144
+ "id": "B",
145
+ "type_id": 0
146
+ }
147
+ },
148
+ {
149
+ "SpecialToken": {
150
+ "id": "</s>",
151
+ "type_id": 0
152
+ }
153
+ }
154
+ ],
155
+ "special_tokens": {
156
+ "</s>": {
157
+ "id": "</s>",
158
+ "ids": [
159
+ 2
160
+ ],
161
+ "tokens": [
162
+ "</s>"
163
+ ]
164
+ },
165
+ "<s>": {
166
+ "id": "<s>",
167
+ "ids": [
168
+ 0
169
+ ],
170
+ "tokens": [
171
+ "<s>"
172
+ ]
173
+ }
174
+ }
175
+ },
176
+ "decoder": {
177
+ "type": "Metaspace",
178
+ "replacement": "▁",
179
+ "prepend_scheme": "always",
180
+ "split": true
181
+ },
182
+ "model": {
183
+ "type": "Unigram",
184
+ "unk_id": 3,
185
+ "vocab": [
186
+ [
187
+ "<s>",
188
+ 0.0
189
+ ],
190
+ [
191
+ "[PAD]",
192
+ 0.0
193
+ ],
194
+ [
195
+ "</s>",
196
+ 0.0
197
+ ],
198
+ [
199
+ "[UNK]",
200
+ 0.0
201
+ ],
202
+ [
203
+ "[MASK]",
204
+ 0.0
205
+ ]
206
+ ],
207
+ "byte_fallback": false
208
+ }
209
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": true,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<s>",
5
+ "cls_token": "[CLS]",
6
+ "eos_token": "</s>",
7
+ "mask_token": "[MASK]",
8
+ "model_max_length": 512,
9
+ "pad_token": "[PAD]",
10
+ "sep_token": "[SEP]",
11
+ "sp_model_kwargs": {
12
+ "enable_sampling": false
13
+ },
14
+ "tokenizer_class": "XLMRobertaTokenizer",
15
+ "unk_token": "[UNK]",
16
+ "language": "bal",
17
+ "keep_accents": true,
18
+ "strip_accents": false,
19
+ "do_lower_case": false
20
+ }