PooryaPiroozfar
commited on
Commit
•
cc99a14
1
Parent(s):
443d30c
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- flair
|
4 |
+
- token-classification
|
5 |
+
- sequence-tagger-model
|
6 |
+
language: fa
|
7 |
+
dataset:
|
8 |
+
- NSURL-2019
|
9 |
+
widget:
|
10 |
+
- text: >-
|
11 |
+
کارنامه نشر، وابسته به موسسه خانه کتاب و زیر نظر احمد مسجدی جامعی معاون امور
|
12 |
+
فرهنگی وزارت فرهنگ و ارشاد اسلامی است.
|
13 |
+
metrics:
|
14 |
+
- f1
|
15 |
+
---
|
16 |
+
|
17 |
+
## Persian NER Using Flair
|
18 |
+
|
19 |
+
This is the 7-class Named-entity recognition model for Persian that ships with [Flair](https://github.com/flairNLP/flair/).
|
20 |
+
|
21 |
+
F1-Score: **90.33** (NSURL-2019)
|
22 |
+
|
23 |
+
Predicts NER tags:
|
24 |
+
|
25 |
+
| **tag** | **meaning** |
|
26 |
+
|:---------------------------------:|:-----------:|
|
27 |
+
| PER | person name |
|
28 |
+
| LOC | location name |
|
29 |
+
| ORG | organization name |
|
30 |
+
| DAT | date |
|
31 |
+
| TIM | time |
|
32 |
+
| PCT | percent |
|
33 |
+
| MON | Money|
|
34 |
+
|
35 |
+
Based on [Flair embeddings](https://www.aclweb.org/anthology/C18-1139/) and Pars-Bert.
|
36 |
+
|
37 |
+
---
|
38 |
+
|
39 |
+
### Demo: How to use in Flair
|
40 |
+
|
41 |
+
Requires: **[Flair](https://github.com/flairNLP/flair/)** (`pip install flair`)
|
42 |
+
|
43 |
+
```python
|
44 |
+
from flair.data import Sentence
|
45 |
+
from flair.models import SequenceTagger
|
46 |
+
# load tagger
|
47 |
+
tagger = SequenceTagger.load("PooryaPiroozfar/Flair_Persian_NER")
|
48 |
+
# make example sentence
|
49 |
+
sentence = Sentence("کارنامه نشر، وابسته به موسسه خانه کتاب و زیر نظر احمد مسجدی جامعی معاون امور فرهنگی وزارت فرهنگ و ارشاد اسلامی است.")
|
50 |
+
tagger.predict(sentence)
|
51 |
+
#print result
|
52 |
+
print(sentence.to_tagged_string())
|
53 |
+
```
|
54 |
+
|
55 |
+
This yields the following output:
|
56 |
+
```
|
57 |
+
|
58 |
+
```
|
59 |
+
|
60 |
+
---
|
61 |
+
|
62 |
+
### Results
|
63 |
+
- F-score (micro) 0.9033
|
64 |
+
- F-score (macro) 0.8976
|
65 |
+
- Accuracy 0.8277
|
66 |
+
|
67 |
+
```
|
68 |
+
By class:
|
69 |
+
precision recall f1-score support
|
70 |
+
|
71 |
+
ORG 0.9016 0.8667 0.8838 1523
|
72 |
+
LOC 0.9113 0.9305 0.9208 1425
|
73 |
+
PER 0.9216 0.9322 0.9269 1224
|
74 |
+
DAT 0.8623 0.7958 0.8277 480
|
75 |
+
MON 0.9665 0.9558 0.9611 181
|
76 |
+
PCT 0.9375 0.9740 0.9554 77
|
77 |
+
TIM 0.8235 0.7925 0.8077 53
|
78 |
+
|
79 |
+
micro avg 0.9081 0.8984 0.9033 4963
|
80 |
+
macro avg 0.9035 0.8925 0.8976 4963
|
81 |
+
weighted avg 0.9076 0.8984 0.9028 4963
|
82 |
+
samples avg 0.8277 0.8277 0.8277 4963
|
83 |
+
|
84 |
+
```
|