Added model usage.
Browse files
README.md
CHANGED
@@ -4,6 +4,45 @@ A transformer-based model for named entity recognition for Polish.
|
|
4 |
The model was trained on the NKJP corpus to recognize 12 categories of NEs.
|
5 |
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
## Author
|
8 |
|
9 |
Michał Marcińczuk <[email protected]>
|
|
|
4 |
The model was trained on the NKJP corpus to recognize 12 categories of NEs.
|
5 |
|
6 |
|
7 |
+
## Usage
|
8 |
+
|
9 |
+
```bash
|
10 |
+
conda create -n pdn2_demo python=3.8
|
11 |
+
```
|
12 |
+
|
13 |
+
```bash
|
14 |
+
conda activate pdn2_demo
|
15 |
+
```
|
16 |
+
|
17 |
+
```bash
|
18 |
+
https://pypi.clarin-pl.eu/packages/poldeepner2-0.8.2-py3-none-any.whl
|
19 |
+
```
|
20 |
+
|
21 |
+
```bash
|
22 |
+
git clone https://huggingface.co/CodeNLP/pdn2_v08_nkjp_large
|
23 |
+
```
|
24 |
+
|
25 |
+
```python
|
26 |
+
import poldeepner2
|
27 |
+
|
28 |
+
ner = poldeepner2.load("pdn2_v08_nkjp_large", device="cpu")
|
29 |
+
|
30 |
+
|
31 |
+
text = "Od 15 września 2023 roku premierem Łotwy jest Evika Siliņa"
|
32 |
+
|
33 |
+
for an in ner.process_text(text):
|
34 |
+
print(f"[{an.start}:{an.end}] {an.text} ({an.label})")
|
35 |
+
```
|
36 |
+
|
37 |
+
Expected output:
|
38 |
+
```
|
39 |
+
[3:24] 15 września 2023 roku (date)
|
40 |
+
[35:40] Łotwy (placeName_country)
|
41 |
+
[46:58] Evika Siliņa (persName)
|
42 |
+
[46:51] Evika (persName_forename)
|
43 |
+
[52:58] Siliņa (persName_surname)
|
44 |
+
```
|
45 |
+
|
46 |
## Author
|
47 |
|
48 |
Michał Marcińczuk <[email protected]>
|