Downloads · 30 days
4
17% of all-time downloads
hamidsalimi/persian-gliner-ner
persian-gliner-ner is a token classification model from hamidsalimi. 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.
Model type: Token Classification / Named Entity Recognition Language: Persian (fa) Base model: microsoft/mdeberta-v3-base GLiNER version: v0.2.28 License: Apache 2.0
Downloads · 30 days
4
17% of all-time downloads
All-time downloads
24
Public
Repo size
3.5 GB
Likes
0
Public
Click a slice to open those files.
.pt2.3 GB · 66%
From the Hugging Face model README
Model type: Token Classification / Named Entity Recognition
Language: Persian (fa)
Base model: microsoft/mdeberta-v3-base
GLiNER version: v0.2.28
License: Apache 2.0
This is a fine-tuned GLiNER model for Persian Named Entity Recognition (NER) with 22 entity types. It was trained on 100,000 synthetic Persian NER samples generated from diverse templates covering news, legal, medical, and technical domains.
| # | Label | Description |
|---|---|---|
| 1 | PERSON | People names |
| 2 | ORGANIZATION | Companies, institutions |
| 3 | LOCATION | General locations |
| 4 | DATE | Dates, years |
| 5 | TIME | Times, durations |
| 6 | MONEY | Monetary values |
| 7 | PERCENT | Percentage values |
| 8 | PROVINCE | Iranian provinces |
| 9 | CITY | Cities and towns |
| 10 | COUNTY | Counties (شهرستان) |
| 11 | FACILITY | Buildings, venues |
| 12 | EVENT | Events, incidents |
| 13 | LAW | Laws, regulations |
| 14 | LANGUAGE | Languages |
| 15 | NATIONALITY | Nationalities |
| 16 | RELIGION | Religious concepts |
| 17 | POLITICAL_PARTY | Political parties |
| 18 | CULTURAL_CONCEPT | Cultural concepts |
| 19 | PRODUCT | Products, goods |
| 20 | NARCOTICS | Drugs, narcotics |
| 21 | WEAPON | Weapons, arms |
| 22 | ALCOHOLIC_BEVERAGES | Alcoholic beverages |
Evaluated on 5,000 validation samples using seqeval:
| Metric | Score |
|---|---|
| Micro F1 | 0.79 |
| Micro Precision | 0.90 |
| Micro Recall | 0.70 |
| Macro F1 | 0.64 |
| Weighted F1 | 0.74 |
| Label | Precision | Recall | F1 | Support |
|---|---|---|---|---|
| PERSON | 0.80 | 0.90 | 0.85 | 323 |
| ORGANIZATION | 1.00 | 0.71 | 0.83 | 617 |
| LOCATION | 0.86 | 0.86 | 0.86 | 652 |
| DATE | 0.91 | 0.88 | 0.90 | 1214 |
| TIME | 1.00 | 0.83 | 0.91 | 597 |
| MONEY | 1.00 | 0.76 | 0.87 | 320 |
| PERCENT | 1.00 | 0.02 | 0.03 | 322 |
| PROVINCE | 0.97 | 0.99 | 0.98 | 619 |
| CITY | 1.00 | 0.72 | 0.83 | 2528 |
| COUNTY | 1.00 | 0.83 | 0.91 | 300 |
| FACILITY | 1.00 | 0.87 | 0.93 | 623 |
| EVENT | 0.72 | 1.00 | 0.84 | 663 |
| LAW | 1.00 | 0.94 | 0.97 | 646 |
| LANGUAGE | 0.58 | 0.85 | 0.69 | 306 |
| NATIONALITY | 1.00 | 0.27 | 0.42 | 317 |
| RELIGION | 1.00 | 1.00 | 1.00 | 338 |
| POLITICAL_PARTY | 1.00 | 0.98 | 0.99 | 263 |
| CULTURAL_CONCEPT | 0.00 | 0.00 | 0.00 | 309 |
| PRODUCT | 1.00 | 0.02 | 0.03 | 322 |
| NARCOTICS | 0.00 | 0.00 | 0.00 | 316 |
| WEAPON | 0.00 | 0.00 | 0.00 | 316 |
| ALCOHOLIC_BEVERAGES | 0.14 | 0.14 | 0.14 | 316 |
from gliner import GLiNER
# Load the model
model = GLiNER.from_pretrained("your-username/persian-gliner-ner")
model.eval()
# Define entity labels
labels = [
"PERSON", "ORGANIZATION", "LOCATION", "DATE", "TIME", "MONEY", "PERCENT",
"PROVINCE", "CITY", "COUNTY", "FACILITY", "EVENT", "LAW", "LANGUAGE",
"NATIONALITY", "RELIGION", "POLITICAL_PARTY", "CULTURAL_CONCEPT", "PRODUCT",
"NARCOTICS", "WEAPON", "ALCOHOLIC_BEVERAGES",
]
# Example text
text = "دانشگاه تهران یکی از بزرگترین دانشگاههای ایران است که در منطقه فنآوری اطلاعات تهران قرار دارد."
# Predict entities
entities = model.predict_entities(text, labels, threshold=0.5)
# Display results
for e in entities:
print(f"{e['label']}: {e['text']} (score: {e['score']:.3f})")