Update README for Persian spaCy pipelines
Improved README clarity and added installation instructions for Persian spaCy pipelines.
This commit is contained in:
parent
35e6d7e792
commit
b20380f97f
25
README.md
25
README.md
|
|
@ -1,27 +1,26 @@
|
||||||
# Persian (Farsi) pipelines for spaCy
|
# Persian (Farsi) pipelines for spaCy
|
||||||
|
|
||||||
Trained spaCy pipelines for Persianinstallable now. spaCy has
|
Trained spaCy pipelines for Persian, installable now. spaCy has never shipped an official one, and `spacy.blank("fa")` only gives you a tokenizer and stop words. These pipelines are built from the UD_Persian-PerDT treebank. choose between `fa_core_news_sm` (full syntax + NER) or `fa_dep_news_sm` (syntax only).
|
||||||
never shipped one, and `spacy.blank("fa")` gives you a tokenizer and stop words.
|
|
||||||
This pipeline built from UD_Persian-PerDT.
|
|
||||||
```bash
|
```bash
|
||||||
pip install https://huggingface.co/Phazel/fa_core_news_sm/resolve/main/fa_core_news_sm-any-py3-none-any.whl
|
pip install https://huggingface.co/Phazel/fa_core_news_sm/resolve/main/fa_core_news_sm-any-py3-none-any.whl
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import spacy
|
>>> import spacy
|
||||||
nlp = spacy.load("fa_core_news_sm")
|
>>> nlp = spacy.load("fa_core_news_sm")
|
||||||
|
|
||||||
doc = nlp("محمدرضا شجریان در مشهد به دنیا آمد.")
|
>>> doc = nlp("محمدرضا شجریان در مشهد به دنیا آمد.")
|
||||||
print([(t.text, t.pos_, t.lemma_, t.dep_) for t in doc][:3])
|
>>> [(t.text, t.pos_, t.lemma_, t.dep_) for t in doc][:3]
|
||||||
# [('محمدرضا', 'PROPN', 'محمدرضا', 'nsubj'), ('شجریان', 'PROPN', 'شجریان', 'flat:name'), ...]
|
[('محمدرضا', 'PROPN', 'محمدرضا', 'nsubj'), ('شجریان', 'PROPN', 'شجریان', 'flat:name'), ...]
|
||||||
print(doc.ents) # (محمدرضا شجریان, مشهد) -> PER, LOC
|
>>> doc.ents
|
||||||
|
(محمدرضا شجریان, مشهد)
|
||||||
|
|
||||||
doc = nlp("شرکت ایران خودرو تولید را ۲۰ درصد افزایش میدهد.")
|
>>> doc = nlp("شرکت ایران خودرو تولید را ۲۰ درصد افزایش میدهد.")
|
||||||
print([(e.text, e.label_) for e in doc.ents]) # ۲۰ درصد -> PCT
|
>>> [(e.text, e.label_) for e in doc.ents]
|
||||||
|
[('۲۰ درصد', 'PCT')]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Results
|
## Results
|
||||||
|
|
||||||
From `spacy benchmark accuracy`, stored in `metrics/`.
|
From `spacy benchmark accuracy`, stored in `metrics/`.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue