Update README.md
Browse files
README.md
CHANGED
@@ -40,7 +40,26 @@ This is a baseline model for named entity **recognition** trained on the cross-t
|
|
40 |
|
41 |
# Usage
|
42 |
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
# Citation
|
46 |
|
|
|
40 |
|
41 |
# Usage
|
42 |
|
43 |
+
```python
|
44 |
+
from transformers import pipeline
|
45 |
+
|
46 |
+
|
47 |
+
model = "SlavicNLP/slavicner-ner-cross-topic-large"
|
48 |
+
|
49 |
+
text = """Nie jest za późno, aby powstrzymać Brexit, a Wielka Brytania wciąż
|
50 |
+
może zmienić zdanie - powiedział przewodniczący Rady Europejskiej
|
51 |
+
eurodeputowanym w Strasburgu"""
|
52 |
+
|
53 |
+
pipe = pipeline("ner", model, aggregation_strategy="simple")
|
54 |
+
|
55 |
+
entities = pipe(text)
|
56 |
+
|
57 |
+
print(*entities, sep="\n")
|
58 |
+
# {'entity_group': 'EVT', 'score': 0.99720407, 'word': 'Brexit', 'start': 35, 'end': 41}
|
59 |
+
# {'entity_group': 'LOC', 'score': 0.9656372, 'word': 'Wielka Brytania', 'start': 45, 'end': 60}
|
60 |
+
# {'entity_group': 'ORG', 'score': 0.9977708, 'word': 'Rady Europejskiej', 'start': 115, 'end': 132}
|
61 |
+
# {'entity_group': 'LOC', 'score': 0.95184135, 'word': 'Strasburgu', 'start': 151, 'end': 161}
|
62 |
+
```
|
63 |
|
64 |
# Citation
|
65 |
|