--- license: apache-2.0 language: - ar base_model: google/embeddinggemma-2 library_name: transformers pipeline_tag: feature-extraction tags: - arabic - ocr - document-ai - word-matching - multimodal-embedding - embeddinggemma datasets: - seemorg/books-ocr --- # ArabicWordsEmbedding - Fine-tuned from [google/embeddinggemma-2](https://huggingface.co/google/embeddinggemma-2) (440M parameters with the audio encoder removed). ## Training - **Real data:** about 400k word crops from 3,000 scanned pages of classical Arabic printed books ([seemorg/books-ocr](https://huggingface.co/datasets/seemorg/books-ocr), human-reviewed transcriptions). Word boxes come from Tesseract and are aligned to the transcription. - **Synthetic data:** generated on the fly in about 50 fonts. Each word is rendered with full, partial or no tashkeel, attached punctuation and neighbouring words, then cropped like a word detector would and degraded like a scan (low resolution, blur, JPEG, binarisation, noise, rotation). - **Objective:** contrastive (InfoNCE). Every batch contains lookalike words (same letters without dots), plus targeted pairs where tashkeel or punctuation imitates a dot. - **Method:** LoRA on the vision tower and the transformer, merged into this checkpoint. ## Limitations - Trained and tested on **printed** Arabic book pages. Handwriting, scene text and decorative fonts were not evaluated. - Real-data boxes came from Tesseract. A detector that cuts boxes very differently (much tighter, or several words per box) may need a quick check. - Short words that differ by one prefix letter (ل / ال / و) cause most of the remaining real errors. - Matching inside one page is the intended use. Open-vocabulary recognition is weaker: 93.6% top-1 among 31.7k words. ## License Apache 2.0, the same as the base model [google/embeddinggemma-2](https://huggingface.co/google/embeddinggemma-2). Training pages come from [seemorg/books-ocr](https://huggingface.co/datasets/seemorg/books-ocr) (MIT).