An audit of presentation-form corruption in 341 public Arabic datasets
Abstract
A measured sweep of 341 public Arabic-language datasets on the Hugging Face Hub for text corrupted by the widespread arabic_reshaper.reshape() + python-bidi get_display() pre-shaping recipe, which stores Arabic as Unicode presentation forms in visual order rather than as logical-order text. Method. Datasets were read through the Hugging Face datasets-server rows API (100 rows each, no full download). Characters were classified as presentation forms by deriving the class from the Unicode character NAME (matching ISOLATED / INITIAL / MEDIAL / FINAL FORM) rather than by tabulating codepoint ranges, so newly assigned Unicode self-classifies. Findings are graded by run length: stray (1 form), partial (2-4), reshaped (5 or more). Results. 276 of 341 datasets were readable, covering 26,318 rows and 119,517 text fields. One dataset, Yousefmd/arabic_ocr_dataset, is corrupted in 400 of 400 sampled label fields across four sample windows, showing the complete signature of the recipe (initial, medial, final and isolated forms together, with word order reversed). It matters because the corrupted field is the LABEL of an OCR training set, which is the propagation path from a rendering bug into model weights. The other 20 flagged datasets contained only isolated stray glyphs, most commonly U+FE91 ARABIC LETTER BEH INITIAL FORM, consistent with OCR or copy-paste residue rather than the recipe. Measured across all findings: 515 stray, 9 partial and 108 reshaped spans, with all 108 reshaped spans in that single dataset. Tokenizer cost. Measured on four real vocabularies (tokenizer files only, no weights): a word containing a single presentation form is emitted as [UNK] by aubmindlab/bert-base-arabertv02 (6/6) and by multilingual BERT (6/6), while xlm-roberta-base is unaffected (0/6) because it normalises. One corrupted letter out of four is sufficient. The word is not split into subwords, it is discarded. Stated limits. 65 datasets were unreadable, and the viewer fails most often on the LARGEST corpora, so this audit covers the mid and small end of the distribution well and its head poorly. Nothing here reaches web-scale pretraining data. A 100-row sample cannot find a defect confined to a rare subset. A presentation form proves stored glyph forms, not the specific recipe that produced them. A false positive documented as a warning. The first run of this audit reported 35.6% corruption in an Islamic heritage OCR corpus. Every hit was a Quranic quotation mark: the ornate parentheses U+FD3E and U+FD3F sit inside the Arabic Presentation Forms-A block, interleaved with genuine positional forms, as do the honorifics at U+FD40 to U+FD4F. Anyone auditing Arabic text by codepoint range will hit this, and will hit it hardest on religious and classical material. Contents: the full per-dataset results (results.jsonl), the raw sweep output, the severity and tokenizer-cost measurements, the written findings, and every script needed to re-derive the numbers.