Update README.md
Browse files
README.md
CHANGED
@@ -7,3 +7,28 @@ inference: false
|
|
7 |
|
8 |
# NER_ARMAN_parsbert
|
9 |
This model is fine-tuned for Named Entity Recognition task. It has been fine-tuned on ARMAN Dataset, using the pretrained model [bert-base-parsbert-ner-uncased](https://huggingface.co/HooshvareLab/bert-base-parsbert-ner-uncased).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
# NER_ARMAN_parsbert
|
9 |
This model is fine-tuned for Named Entity Recognition task. It has been fine-tuned on ARMAN Dataset, using the pretrained model [bert-base-parsbert-ner-uncased](https://huggingface.co/HooshvareLab/bert-base-parsbert-ner-uncased).
|
10 |
+
|
11 |
+
## Usage
|
12 |
+
|
13 |
+
```python
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
def predict(input_text):
|
18 |
+
nlp = pipeline("ner", model="PardisSzah/NER_ARMAN_parsbert")
|
19 |
+
output_predictions = []
|
20 |
+
for sequence in input_text:
|
21 |
+
result = nlp(sequence)
|
22 |
+
output_predictions.append(result)
|
23 |
+
return output_predictions
|
24 |
+
|
25 |
+
text = [
|
26 |
+
"علی اکبری در روز شنبه به دیدن مادرش مریم حسنی رفت و بعد به بیمارستان ارتش سر زد"
|
27 |
+
]
|
28 |
+
|
29 |
+
output = predict(text)
|
30 |
+
print(output)
|
31 |
+
|
32 |
+
|
33 |
+
# output: [[{'entity': 'B-person', 'score': 0.9998951, 'index': 1, 'word': 'علی', 'start': 0, 'end': 3}, {'entity': 'I-person', 'score': 0.9999027, 'index': 2, 'word': 'اکبری', 'start': 4, 'end': 9}, {'entity': 'B-person', 'score': 0.9998709, 'index': 9, 'word': 'مریم', 'start': 36, 'end': 40}, {'entity': 'I-person', 'score': 0.9996691, 'index': 10, 'word': 'حسنی', 'start': 41, 'end': 45}, {'entity': 'B-facility', 'score': 0.9561743, 'index': 15, 'word': 'بیمارستان', 'start': 59, 'end': 68}, {'entity': 'I-facility', 'score': 0.9976502, 'index': 16, 'word': 'ارتش', 'start': 69, 'end': 73}]]
|
34 |
+
|