Instructions to use Phazel/fa_ent_news_sm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- spaCy
How to use Phazel/fa_ent_news_sm with spaCy:
!pip install https://huggingface.co/Phazel/fa_ent_news_sm/resolve/main/fa_ent_news_sm-any-py3-none-any.whl # Using spacy.load(). import spacy nlp = spacy.load("fa_ent_news_sm") # Importing as module. import fa_ent_news_sm nlp = fa_ent_news_sm.load() - Notebooks
- Google Colab
- Kaggle
fa_ent_news_sm
Persian named entity recognizer optimized for CPU, with its own internal tok2vec. Labels: PER, LOC, ORG, DAT, MON, TIM, PCT.
Install
pip install https://huggingface.co/Phazel/fa_ent_news_sm/resolve/main/fa_ent_news_sm-3.8.0-py3-none-any.whl
import spacy
nlp = spacy.load("fa_ent_news_sm")
doc = nlp("شرکت ایران خودرو اعلام کرد که تولید خود را افزایش میدهد.")
print([(t.text, t.pos_, t.lemma_, t.dep_) for t in doc])
print([(e.text, e.label_) for e in doc.ents])
Accuracy
Scored with spacy benchmark accuracy on the held-out PerDT test split.
| Metric | Score |
|---|---|
| NER precision | 77.67 |
| NER recall | 66.87 |
| NER F-score | 71.87 |
Throughput
Median of repeated nlp.pipe passes over the 146-document PerDT test
split (23,825 tokens), timing the pipe only. Warmup pass discarded.
| Device | Batch | Words/s |
|---|---|---|
| gpu:0 (NVIDIA GeForce 940MX, 2048 MiB) | 32 | 41,878 |
| cpu (Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz) | 32 | 12,737 |
Sources
| Source | Author | Licence |
|---|---|---|
| UD_Persian-PerDT NER layer (not-to-release/Dadegan with NER tag/) | PerDT authors, tagged with Beheshti-NER (Taher, Hoseini, Shamsfard 2020) | CC BY-SA 4.0 |
| spaCy lang/fa language data (stop words originally from HAZM) | Explosion and spaCy contributors | MIT |
Notes
Trained on UD_Persian-PerDT, licensed CC BY-SA 4.0; this pipeline is therefore distributed under CC BY-SA 4.0 with attribution to the treebank authors. The ner component is trained on the NER layer shipped in UD_Persian-PerDT's not-to-release/ directory, so it shares the treebank's genre, tokenization and licence. Those labels are SILVER: the treebank README states they were produced by the BERT-based Beheshti-NER tagger (Taher et al., 2020) with manual corrections to extend recall. They were transferred onto this pipeline's tokenization by difflib alignment at a 99.86% transfer rate (scripts/transfer_perdt_ner.py); spans that could not be aligned exactly were dropped rather than guessed. Labels PER, LOC, ORG and DAT have 1,300 or more training examples each; MON (205), TIM (135) and PCT (121) are thin and their scores in performance.ents_per_type should be read before relying on them.
- Downloads last month
- 10