Persian named entity recognizer optimized for CPU, with its own internal tok2vec. Labels: PER, LOC, ORG, DAT, MON, TIM, PCT.
1import spacy
2nlp = spacy.load("fa_ent_news_sm")
3doc = nlp("شرکت ایران خودرو اعلام کرد که تولید خود را افزایش میدهد.")
4print([(t.text, t.pos_, t.lemma_, t.dep_) for t in doc])
5print([(e.text, e.label_) for e in doc.ents])
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.