Downloads · 30 days
31
25% of all-time downloads
shekar-ai/albert-base-v2-persian-ner
albert-base-v2-persian-ner is a token classification model from shekar-ai. Use it when you need labels on individual words, such as names. It is set up for transformers. The card lists the license as mit.
Named entity recognition for Persian over five entity types — person, location, organization, date, and event. Fine-tuned from shekar-ai/albert-base-v2-persian-zwnj-naab-mlm on the Persian NER dataset.
Downloads · 30 days
31
25% of all-time downloads
All-time downloads
125
Public
Parameters
11.4M
137 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors45.4 MB · 94%
From the Hugging Face model README
Named entity recognition for Persian over five entity types — person, location, organization, date,
and event. Fine-tuned from
shekar-ai/albert-base-v2-persian-zwnj-naab-mlm
on the Persian NER dataset.
| Task | Token classification (BIO, 11 tags) |
| Parameters | 11.4 M |
| Base model | shekar-ai/albert-base-v2-persian-zwnj-naab-mlm |
| Training data | Persian NER (Text-Mining), ~977k sentences |
| License | MIT |
| Type | Meaning |
|---|---|
PER | Person |
LOC | Location |
ORG | Organization |
DAT | Date |
EVE | Event |
Tagged in BIO format: B-PER, I-PER, …, plus O.
from shekar import NER
ner = NER()
for entity, label in ner("شاهنامه اثر حکیم ابوالقاسم فردوسی در سال ۴۰۰ هجری در توس سروده شد."):
print(f"{entity}\t{label}")
حکیم ابوالقاسم فردوسی PER
در سال ۴۰۰ هجری DAT
توس LOC
from transformers import pipeline
ner = pipeline(
"token-classification",
model="shekar-ai/albert-base-v2-persian-ner",
aggregation_strategy="simple",
)
for entity in ner("شاهنامه اثر حکیم ابوالقاسم فردوسی در سال ۴۰۰ هجری در توس سروده شد."):
print(entity["word"], entity["entity_group"], round(entity["score"], 3))
حکیم ابوالقاسم فردوسی PER 0.994
در سال ۴۰۰ هجری DAT 0.881
توس LOC 0.781
Data. The Persian NER dataset (5 parts merged): 976,599 sentences and 25,023,859 tokens, split randomly 90% train / 10% test. Entity mentions in the full corpus:
| Type | Mentions |
|---|---|
DAT | 735,264 |
LOC | 627,845 |
PER | 386,657 |
ORG | 289,998 |
EVE | 70,845 |
Each word is tokenized independently and the gold tag assigned to its first subtoken; the remaining subtokens are masked out of the loss.
| Hyperparameter | Value |
|---|---|
| Epochs | 3 |
| Batch size | 16 |
| Learning rate | 5e-5 |
| LR scheduler | Linear |
| Weight decay | 0.01 |
| Optimizer | AdamW |
Entity-level seqeval scores on the held-out 10% (~97,700 sentences):
| Metric | Value |
|---|---|
| Precision | 75.87 |
| Recall | 76.69 |
| F1 | 76.27 |
| Token accuracy | 96.20 |
| Epoch | Validation loss | Precision | Recall | F1 | Accuracy |
|---|---|---|---|---|---|
| 1 | 0.1127 | 0.7207 | 0.7258 | 0.7233 | 0.9553 |
| 2 | 0.1000 | 0.7474 | 0.7457 | 0.7465 | 0.9599 |
| 3 | 0.0990 | 0.7587 | 0.7669 | 0.7627 | 0.9620 |
@article{Amirivojdan2025Shekar,
author = {Amirivojdan, Ahmad},
title = {{Shekar: A Python Toolkit for Persian Natural Language Processing}},
journal = {Journal of Open Source Software},
volume = {10},
number = {114},
pages = {9128},
year = {2025},
doi = {10.21105/joss.09128},
url = {https://joss.theoj.org/papers/10.21105/joss.09128}
}