Ouaill commited on
Commit
b05b030
Β·
verified Β·
1 Parent(s): 98c39de

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +39 -4
README.md CHANGED
@@ -137,29 +137,64 @@ All fertility and CPT metrics include **bootstrap 95% confidence intervals** (n=
137
  ### Morph Edit Distance Heatmap
138
  ![Morph Edit Distance Heatmap](plots/morph_edit_distance_ar_heatmap_v2.png)
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  ## Repository Structure
141
 
142
  ```
143
  daa-tokenizers/
144
  β”œβ”€β”€ README.md # This file
145
  β”œβ”€β”€ script.py # Benchmark script (reproducible)
 
146
  β”œβ”€β”€ tokenizer_results.csv # Full metrics table
147
  β”œβ”€β”€ tokenizer_results.json # Full metrics (JSON)
148
  β”œβ”€β”€ bootstrap_ci.csv # Bootstrap 95% CIs
 
 
149
  β”œβ”€β”€ benchmark_report.md # Detailed report
150
  β”œβ”€β”€ morphology/
151
  β”‚ └── farasa_segmentations.json # Cached Farasa morph segmentations (~100MB)
152
- β”œβ”€β”€ tokenizers/ # Raw tokenizer JSON files (36 files)
153
- β”œβ”€β”€ transformers_tokenizers/ # 28 dirs for transformers library
154
  β”‚ β”œβ”€β”€ shared_bpe_8000/
155
  β”‚ β”œβ”€β”€ shared_bpe_16000/
156
  β”‚ β”œβ”€β”€ ...
157
  β”‚ β”œβ”€β”€ concat_bpe_8000_tokenizer_ar/
158
  β”‚ β”œβ”€β”€ concat_bpe_8000_tokenizer_az/
159
- β”‚ └── ...
160
- └── plots/ # 24 visualization PNGs
 
 
 
 
 
 
161
  β”œβ”€β”€ fertility_overall_comparison_v2.png
162
  β”œβ”€β”€ bootstrap_ci_forest.png
 
163
  β”œβ”€β”€ morph_edit_distance_ar_heatmap_v2.png
164
  └── ...
165
  ```
 
137
  ### Morph Edit Distance Heatmap
138
  ![Morph Edit Distance Heatmap](plots/morph_edit_distance_ar_heatmap_v2.png)
139
 
140
+ ## Comparison with Existing Tokenizers
141
+
142
+ We compared our best tokenizer per vocabulary size against five existing Arabic and Darija tokenizers from HuggingFace:
143
+
144
+ | Tokenizer | Source | V | Fertility ↓ | Disparity ↓ | EM (Ar) | EM (Az) |
145
+ |-----------|--------|---|-------------|-------------|---------|---------|
146
+ | **Ours: concat BPE 8K** | Darija-specific | 8K | **1.625** | **0.089** | **99.9%** | **99.6%** |
147
+ | **Ours: concat BPE 16K** | Darija-specific | 16K | **1.443** | **0.084** | **99.9%** | **99.6%** |
148
+ | **Ours: concat BPE 32K** | Darija-specific | 32K | **1.270** | **0.084** | -- | -- |
149
+ | CaMeLBERT-MSA | MSA | 30K | 2.289 | 0.427 | 29.9% | 38.9% |
150
+ | Asafaya-BERT | MSA | 32K | 2.143 | 0.358 | 19.9% | 15.2% |
151
+ | Aranizer-SP-86k | MSA | 86K | 1.918 | 0.368 | 99.8% | 99.6% |
152
+ | DarijaBERT-ar | Darija | 80K | 1.761 | 0.410 | 13.7% | 8.0% |
153
+ | DarijaBERT-az | Darija | 110K | 1.575 | 0.055 | 14.8% | 8.0% |
154
+
155
+ Key results:
156
+ - Our **8K** tokenizer (1.625) outperforms all MSA tokenizers (2.143–2.289) by **29–45%** in fertility, despite being 4–11Γ— smaller in vocabulary
157
+ - Our **32K** tokenizer (1.270) outperforms **all** external tokenizers including DarijaBERT-az (1.575) by **19%**
158
+ - All external tokenizers (except DarijaBERT-az) exhibit cross-script disparity > 0.35; our tokenizers maintain ≀ 0.089
159
+ - Our tokenizers achieve >99% exact match; most external BERT-based tokenizers fail to reconstruct Darija text (<40%)
160
+ - `eval_and_compare.py` β€” Reproducible comparison script
161
+ - `external_comparison.csv` / `.json` β€” Full comparison results
162
+
163
+ ![External Comparison](plots/external_comparison.png)
164
+
165
  ## Repository Structure
166
 
167
  ```
168
  daa-tokenizers/
169
  β”œβ”€β”€ README.md # This file
170
  β”œβ”€β”€ script.py # Benchmark script (reproducible)
171
+ β”œβ”€β”€ eval_and_compare.py # External tokenizer comparison script
172
  β”œβ”€β”€ tokenizer_results.csv # Full metrics table
173
  β”œβ”€β”€ tokenizer_results.json # Full metrics (JSON)
174
  β”œβ”€β”€ bootstrap_ci.csv # Bootstrap 95% CIs
175
+ β”œβ”€β”€ external_comparison.csv # Comparison with external tokenizers
176
+ β”œβ”€β”€ external_comparison.json # Comparison with external tokenizers (JSON)
177
  β”œβ”€β”€ benchmark_report.md # Detailed report
178
  β”œβ”€β”€ morphology/
179
  β”‚ └── farasa_segmentations.json # Cached Farasa morph segmentations (~100MB)
180
+ β”œβ”€β”€ tokenizers/ # Raw tokenizer JSON files (40 files)
181
+ β”œβ”€β”€ transformers_tokenizers/ # 32 dirs for transformers library
182
  β”‚ β”œβ”€β”€ shared_bpe_8000/
183
  β”‚ β”œβ”€β”€ shared_bpe_16000/
184
  β”‚ β”œβ”€β”€ ...
185
  β”‚ β”œβ”€β”€ concat_bpe_8000_tokenizer_ar/
186
  β”‚ β”œβ”€β”€ concat_bpe_8000_tokenizer_az/
187
+ β”‚ β”œβ”€β”€ ...
188
+ β”‚ β”œβ”€β”€ concat_bpe_32000_tokenizer_ar/ # Newly trained
189
+ β”‚ β”œβ”€β”€ concat_bpe_32000_tokenizer_az/ # Newly trained
190
+ β”‚ β”œβ”€β”€ concat_unigram_32000_tokenizer_ar/
191
+ β”‚ β”œβ”€β”€ concat_unigram_32000_tokenizer_az/
192
+ β”‚ β”œβ”€β”€ concat_wordpiece_32000_tokenizer_ar/
193
+ β”‚ └── concat_wordpiece_32000_tokenizer_az/
194
+ └── plots/ # 25 visualization PNGs
195
  β”œβ”€β”€ fertility_overall_comparison_v2.png
196
  β”œβ”€β”€ bootstrap_ci_forest.png
197
+ β”œβ”€β”€ external_comparison.png
198
  β”œβ”€β”€ morph_edit_distance_ar_heatmap_v2.png
199
  └── ...
200
  ```