Downloads · 30 days
7
13% of all-time downloads
Elafnawaf/gliner-arabic-ner
gliner-arabic-ner is a token classification model from Elafnawaf. Use it when you need labels on individual words, such as names. It is set up for gliner. The card lists the license as apache-2.0.
Zero-shot-capable span NER for Arabic, fine-tuned on 17 entity types including Saudi national ID numbers and mobile numbers.
Downloads · 30 days
7
13% of all-time downloads
All-time downloads
52
Public
Parameters
289M
2.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.2 GB · 99%
From the Hugging Face model README
Zero-shot-capable span NER for Arabic, fine-tuned on 17 entity types including Saudi national ID numbers and mobile numbers.
Fine-tuned from NAMAA-Space/gliner_arabic-v2.1.
from gliner import GLiNER
model = GLiNER.from_pretrained("Elafnawaf/gliner-arabic-ner")
labels = ['شخص / person', 'منظمة / organization', 'مكان / place', 'عنوان / address']
text = "زار المهندس فهد العتيبي مقر أرامكو في الظهران."
for e in model.predict_entities(text, labels, threshold=0.6, flat_ner=False):
print(e["label"], "->", e["text"])
This repo also ships pipeline.py, which adds the regex layer, the per-label thresholds and the format validator that the published metrics were measured with.
from huggingface_hub import snapshot_download
import sys; sys.path.insert(0, snapshot_download('Elafnawaf/gliner-arabic-ner'))
from pipeline import extract
for e in extract('سجل الدخول برقم الهوية 1098765432'):
print(e['source'], e['label'], e['text'])
11 of the 17 labels are answered by deterministic regexes rather than the network — national IDs, phone numbers, percentages, money, times and similar shapes. A regex is more reliable at those than any amount of training, and it needs no data. The remaining 6 are the model's.
Model-owned (6): شخص / person, منظمة / organization, مكان / place, عنوان / address, مطار / airport, تاريخ / date
Rule-owned (11): ترتيب / ordinal, رقم الهوية الوطنية / national id number, رقم جوال / mobile number, عدد / cardinal number, عملة / currency, كمية / quantity, مبلغ مالي / money, موقع إلكتروني / website, نسبة مئوية / percentage, وحدة قياس / unit of measurement, وقت / time
Labels are model input in GLiNER, so you can ask for types outside this list — accuracy on those is not measured here.
Held-out test split, span-exact match, 14,707 gold entities.
| micro-F1 | |
|---|---|
| zero-shot, before fine-tuning | 0.3859 |
| after fine-tuning | 0.7314 |
| model-owned labels only | 0.7179 |
Trained for 12069 steps.
Modern Standard Arabic only. Every training corpus is MSA. Published work on Arabic NER reports losses of up to 38% F1 on out-of-distribution dialects, so treat Gulf, Levantine or Maghrebi input as untested.
Measured on public corpora, not on production text. The test split is drawn from the same corpora and annotation guidelines as the training data. Expect lower accuracy on text from a different domain.
Span conventions are inherited from the training corpora. Whether a title like
الأمير or a head noun like شركة falls inside a span follows those corpora's
conventions, which may not match yours.
Normalize before you tokenize. Arabic diacritics are not matched by Python's
\w, so undiacritized input is required for correct spans — pipeline.py handles
this, and does the offset mapping back to your original string. If you call the
model directly, do it yourself.
WikiANN (ar), IAHLT MAFAT Arabic NER, the public Wojood sample, plus a synthetic generator for Saudi ID and contact formats. Every ID and phone number in the training data is randomly generated; no real personal data was used.
Built on GLiNER (Zaratiana et al., 2023).