File size: 16,610 Bytes
b194823
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
---
annotations_creators:
- expert-generated
language_creators:
- found
languages:
- pl
licenses:
- cc-by-3.0
multilinguality:
- monolingual
pretty_name: ''
size_categories:
- 18K
- 10K<n<100K
source_datasets:
- original
task_categories:
- structure-prediction
task_ids:
- named-entity-recognition
---

# KPWR-NER

## Description

KPWR-NER is a part the Polish Corpus of Wrocław University of Technology (*Korpus Języka Polskiego Politechniki Wrocławskiej*). Its objective is named entity recognition for fine-grained categories of entities. It is the ‘n82’ version of the KPWr, which means that number of classes is restricted to 82 (originally 120). During corpus creation, texts were annotated by humans from various sources, covering many domains and genres.

## Tasks (input, output and metrics)

Named entity recognition (NER) - tagging entities in text with their corresponding type.

Input ('*tokens'* column): sequence of tokens

Output ('*ner'* column): sequence of predicted tokens’ classes in BIO notation (82 possible classes, described in detail in the annotation guidelines)

*example:*

[*‘Roboty’, ‘mają’, ‘kilkanaście’, ‘lat’, ‘i’, ‘pochodzą’, ‘z’, ‘USA’, ‘,’, ‘Wysokie’, ‘napięcie’, ‘jest’, ‘dużo’, ‘młodsze’, ‘,’, ‘powstało’, ‘w’, ‘Niemczech’, ‘.’*] → [*‘B-nam_pro_title’, ‘O’, ‘O’, ‘O’, ‘O’, ‘O’, ‘O’, ‘B-nam_loc_gpe_country’, ‘O’, ‘B-nam_pro_title’, ‘I-nam_pro_title’, ‘O’, ‘O’, ‘O’, ‘O’, ‘O’, ‘O’, ‘B-nam_loc_gpe_country’, ‘O’*]

Measurements:

## Data splits


| Subset | Cardinality (sentences) |
|--------|------------------------:|
| train  |                   13959 |
| test   |                    4323 |

## Class distribution in train

| Class                       |   Fraction of tokens |
|:----------------------------|---------------------:|
| O                           |             0.898080 |
| B-nam_liv_person            |             0.012769 |
| I-nam_liv_person            |             0.008246 |
| I-nam_org_institution       |             0.006448 |
| B-nam_loc_gpe_city          |             0.005886 |
| B-nam_loc_gpe_country       |             0.004351 |
| I-nam_org_organization      |             0.003728 |
| B-nam_org_institution       |             0.003434 |
| I-nam_pro_title_document    |             0.003206 |
| B-nam_org_organization      |             0.002592 |
| B-nam_org_group_team        |             0.002035 |
| B-nam_adj_country           |             0.001987 |
| I-nam_org_group_team        |             0.001851 |
| I-nam_pro_title             |             0.001715 |
| I-nam_eve_human             |             0.001557 |
| B-nam_org_company           |             0.001421 |
| I-nam_org_company           |             0.001316 |
| B-nam_pro_media_periodic    |             0.001312 |
| I-nam_fac_goe               |             0.001285 |
| I-nam_pro_media_periodic    |             0.001254 |
| B-nam_fac_road              |             0.001162 |
| B-nam_liv_god               |             0.001127 |
| I-nam_eve_human_sport       |             0.001057 |
| B-nam_org_nation            |             0.001013 |
| B-nam_oth_tech              |             0.001004 |
| B-nam_pro_media_web         |             0.000996 |
| B-nam_fac_goe               |             0.000930 |
| B-nam_eve_human             |             0.000917 |
| B-nam_pro_title             |             0.000908 |
| B-nam_pro_brand             |             0.000899 |
| I-nam_pro_model_car         |             0.000877 |
| I-nam_pro_brand             |             0.000868 |
| I-nam_loc_gpe_city          |             0.000847 |
| B-nam_org_political_party   |             0.000737 |
| I-nam_loc_gpe_country       |             0.000715 |
| B-nam_loc_gpe_admin1        |             0.000711 |
| I-nam_pro_title_treaty      |             0.000697 |
| B-nam_eve_human_sport       |             0.000684 |
| I-nam_org_political_party   |             0.000680 |
| B-nam_pro_software          |             0.000636 |
| I-nam_fac_road              |             0.000623 |
| B-nam_adj                   |             0.000561 |
| B-nam_loc_gpe_admin3        |             0.000518 |
| B-nam_pro_model_car         |             0.000509 |
| B-nam_loc_hydronym_river    |             0.000491 |
| B-nam_oth                   |             0.000452 |
| B-nam_pro_title_document    |             0.000430 |
| B-nam_loc_astronomical      |             0.000425 |
| B-nam_oth_currency          |             0.000421 |
| B-nam_adj_city              |             0.000390 |
| I-nam_eve                   |             0.000373 |
| I-nam_org_group_band        |             0.000364 |
| B-nam_org_group_band        |             0.000342 |
| I-nam_pro_media_web         |             0.000329 |
| I-nam_pro_title_book        |             0.000329 |
| B-nam_loc_gpe_admin2        |             0.000329 |
| I-nam_pro_software          |             0.000320 |
| I-nam_eve_human_cultural    |             0.000298 |
| I-nam_oth_tech              |             0.000294 |
| B-nam_loc_gpe_district      |             0.000294 |
| I-nam_oth                   |             0.000285 |
| B-nam_loc_land_continent    |             0.000268 |
| B-nam_loc_country_region    |             0.000268 |
| B-nam_loc_land_mountain     |             0.000241 |
| I-nam_pro_title_article     |             0.000228 |
| B-nam_pro_title_book        |             0.000224 |
| B-nam_loc_historical_region |             0.000219 |
| B-nam_loc                   |             0.000211 |
| B-nam_eve                   |             0.000211 |
| B-nam_org_group             |             0.000193 |
| B-nam_loc_land_island       |             0.000193 |
| I-nam_pro_title_tv          |             0.000193 |
| I-nam_pro_title_album       |             0.000189 |
| B-nam_pro_media_tv          |             0.000184 |
| B-nam_liv_habitant          |             0.000184 |
| B-nam_eve_human_cultural    |             0.000184 |
| I-nam_pro_title_song        |             0.000184 |
| I-nam_oth_license           |             0.000180 |
| B-nam_pro_title_tv          |             0.000180 |
| I-nam_oth_position          |             0.000175 |
| I-nam_loc_country_region    |             0.000171 |
| I-nam_loc_gpe_admin1        |             0.000171 |
| B-nam_oth_license           |             0.000167 |
| B-nam_num_house             |             0.000149 |
| B-nam_pro_title_treaty      |             0.000145 |
| B-nam_fac_system            |             0.000145 |
| I-nam_loc_gpe_admin3        |             0.000140 |
| B-nam_loc_gpe_subdivision   |             0.000140 |
| I-nam_eve_human_holiday     |             0.000136 |
| I-nam_org_group             |             0.000136 |
| B-nam_loc_land_region       |             0.000132 |
| I-nam_pro_award             |             0.000132 |
| I-nam_loc_land_mountain     |             0.000132 |
| I-nam_loc_astronomical      |             0.000132 |
| B-nam_pro_title_album       |             0.000127 |
| I-nam_pro_software_game     |             0.000123 |
| B-nam_adj_person            |             0.000118 |
| B-nam_fac_square            |             0.000114 |
| I-nam_pro_media_radio       |             0.000114 |
| B-nam_pro_award             |             0.000110 |
| B-nam_eve_human_holiday     |             0.000110 |
| I-nam_loc                   |             0.000101 |
| B-nam_pro_title_song        |             0.000096 |
| I-nam_loc_gpe_subdivision   |             0.000096 |
| B-nam_pro_media_radio       |             0.000088 |
| I-nam_loc_gpe_district      |             0.000088 |
| B-nam_pro_vehicle           |             0.000088 |
| I-nam_loc_land_island       |             0.000083 |
| I-nam_fac_park              |             0.000083 |
| B-nam_oth_position          |             0.000083 |
| B-nam_liv_animal            |             0.000083 |
| I-nam_pro                   |             0.000083 |
| B-nam_pro                   |             0.000079 |
| I-nam_loc_historical_region |             0.000079 |
| I-nam_loc_land_region       |             0.000075 |
| I-nam_liv_god               |             0.000075 |
| I-nam_num_phone             |             0.000075 |
| I-nam_fac_bridge            |             0.000075 |
| I-nam_pro_media_tv          |             0.000070 |
| B-nam_oth_www               |             0.000070 |
| B-nam_num_phone             |             0.000070 |
| B-nam_pro_title_article     |             0.000066 |
| B-nam_oth_data_format       |             0.000066 |
| B-nam_fac_bridge            |             0.000061 |
| B-nam_liv_character         |             0.000057 |
| I-nam_org_organization_sub  |             0.000053 |
| B-nam_pro_software_game     |             0.000053 |
| B-nam_loc_hydronym_lake     |             0.000053 |
| B-nam_loc_gpe_conurbation   |             0.000053 |
| B-nam_pro_media             |             0.000048 |
| I-nam_fac_square            |             0.000044 |
| B-nam_loc_land              |             0.000044 |
| B-nam_loc_land_peak         |             0.000044 |
| B-nam_fac_park              |             0.000039 |
| B-nam_org_organization_sub  |             0.000035 |
| I-nam_loc_hydronym_lake     |             0.000035 |
| B-nam_loc_hydronym          |             0.000035 |
| I-nam_pro_vehicle           |             0.000035 |
| I-nam_loc_gpe_conurbation   |             0.000035 |
| I-nam_fac_goe_stop          |             0.000035 |
| I-nam_fac_system            |             0.000031 |
| I-nam_pro_media             |             0.000031 |
| I-nam_loc_gpe_admin2        |             0.000031 |
| I-nam_loc_land              |             0.000026 |
| B-nam_loc_hydronym_sea      |             0.000026 |
| B-nam_loc_hydronym_ocean    |             0.000026 |
| I-nam_org_nation            |             0.000026 |
| I-nam_liv_character         |             0.000022 |
| I-nam_oth_www               |             0.000022 |
| B-nam_fac_goe_stop          |             0.000022 |
| I-nam_loc_hydronym_sea      |             0.000018 |
| I-nam_oth_currency          |             0.000018 |
| I-nam_loc_hydronym          |             0.000018 |
| I-nam_liv_animal            |             0.000018 |
| I-nam_loc_hydronym_river    |             0.000018 |
| I-nam_oth_data_format       |             0.000013 |
| I-nam_loc_land_continent    |             0.000009 |
| I-nam_loc_land_peak         |             0.000009 |
| I-nam_num_house             |             0.000009 |
| I-nam_loc_hydronym_ocean    |             0.000009 |

## Citation

```
@inproceedings{broda-etal-2012-kpwr,
    title = "{KPW}r: Towards a Free Corpus of {P}olish",
    author = "Broda, Bartosz  and
      Marci{\'n}czuk, Micha{\l}  and
      Maziarz, Marek  and
      Radziszewski, Adam  and
      Wardy{\'n}ski, Adam",
    booktitle = "Proceedings of the Eighth International Conference on Language Resources and Evaluation ({LREC}'12)",
    month = may,
    year = "2012",
    address = "Istanbul, Turkey",
    publisher = "European Language Resources Association (ELRA)",
    url = "http://www.lrec-conf.org/proceedings/lrec2012/pdf/965_Paper.pdf",
    pages = "3218--3222",
    abstract = "This paper presents our efforts aimed at collecting and annotating a free Polish corpus. The corpus will serve for us as training and testing material for experiments with Machine Learning algorithms. As others may also benefit from the resource, we are going to release it under a Creative Commons licence, which is hoped to remove unnecessary usage restrictions, but also to facilitate reproduction of our experimental results. The corpus is being annotated with various types of linguistic entities: chunks and named entities, selected syntactic and semantic relations, word senses and anaphora. We report on the current state of the project as well as our ultimate goals.",
}
```

## License

```
Creative Commons Attribution 3.0 Unported Licence
```

## Links

[HuggingFace](https://huggingface.co/datasets/clarin-pl/kpwr-ner)

[Source](https://clarin-pl.eu/index.php/kpwr-en/)

[Paper](https://aclanthology.org/L12-1574/)

[KPWr annotation guidelines](http://www.nlp.pwr.wroc.pl/narzedzia-i-zasoby/zasoby/kpwr-lemma/16-narzedzia-zasoby/79-wytyczne)

[KPWr annotation guidelines - named entities](https://clarin-pl.eu/dspace/handle/11321/294)

## Examples

### Loading

```python
from pprint import pprint

from datasets import load_dataset

dataset = load_dataset("clarin-pl/kpwr-ner")
pprint(dataset['train'][0])

# {'lemmas': ['roborally', 'czy', 'wysoki', 'napięcie', '?'],
#  'ner': [73, 160, 73, 151, 160],
#  'orth': ['subst:sg:nom:n',
#           'qub',
#           'adj:sg:nom:n:pos',
#           'subst:sg:nom:n',
#           'interp'],
#  'tokens': ['RoboRally', 'czy', 'Wysokie', 'napięcie', '?']}
```

### Evaluation

```python
import random
from pprint import pprint

from datasets import load_dataset, load_metric

dataset = load_dataset("clarin-pl/kpwr-ner")
references = dataset["test"]["ner"]

# generate random predictions
predictions = [
    [
        random.randrange(dataset["train"].features["ner"].feature.num_classes)
        for _ in range(len(labels))
    ]
    for labels in references
]

# transform to original names of labels
references_named = [
    [dataset["train"].features["ner"].feature.names[label] for label in labels]
    for labels in references
]
predictions_named = [
    [dataset["train"].features["ner"].feature.names[label] for label in labels]
    for labels in predictions
]

# utilise seqeval to evaluate
seqeval = load_metric("seqeval")
seqeval_score = seqeval.compute(
    predictions=predictions_named, references=references_named, scheme="IOB2"
)

pprint(seqeval_score, depth=1)

# {'nam_adj': {...},
#  'nam_adj_city': {...},
#  'nam_adj_country': {...},
#  'nam_adj_person': {...},
#  'nam_eve': {...},
#  'nam_eve_human': {...},
#  'nam_eve_human_cultural': {...},
#  'nam_eve_human_holiday': {...},
#  'nam_eve_human_sport': {...},
#  'nam_fac_bridge': {...},
#  'nam_fac_goe': {...},
#  'nam_fac_goe_stop': {...},
#  'nam_fac_park': {...},
#  'nam_fac_road': {...},
#  'nam_fac_square': {...},
#  'nam_fac_system': {...},
#  'nam_liv_animal': {...},
#  'nam_liv_character': {...},
#  'nam_liv_god': {...},
#  'nam_liv_habitant': {...},
#  'nam_liv_person': {...},
#  'nam_loc': {...},
#  'nam_loc_astronomical': {...},
#  'nam_loc_country_region': {...},
#  'nam_loc_gpe_admin1': {...},
#  'nam_loc_gpe_admin2': {...},
#  'nam_loc_gpe_admin3': {...},
#  'nam_loc_gpe_city': {...},
#  'nam_loc_gpe_conurbation': {...},
#  'nam_loc_gpe_country': {...},
#  'nam_loc_gpe_district': {...},
#  'nam_loc_gpe_subdivision': {...},
#  'nam_loc_historical_region': {...},
#  'nam_loc_hydronym': {...},
#  'nam_loc_hydronym_lake': {...},
#  'nam_loc_hydronym_ocean': {...},
#  'nam_loc_hydronym_river': {...},
#  'nam_loc_hydronym_sea': {...},
#  'nam_loc_land': {...},
#  'nam_loc_land_continent': {...},
#  'nam_loc_land_island': {...},
#  'nam_loc_land_mountain': {...},
#  'nam_loc_land_peak': {...},
#  'nam_loc_land_region': {...},
#  'nam_num_house': {...},
#  'nam_num_phone': {...},
#  'nam_org_company': {...},
#  'nam_org_group': {...},
#  'nam_org_group_band': {...},
#  'nam_org_group_team': {...},
#  'nam_org_institution': {...},
#  'nam_org_nation': {...},
#  'nam_org_organization': {...},
#  'nam_org_organization_sub': {...},
#  'nam_org_political_party': {...},
#  'nam_oth': {...},
#  'nam_oth_currency': {...},
#  'nam_oth_data_format': {...},
#  'nam_oth_license': {...},
#  'nam_oth_position': {...},
#  'nam_oth_tech': {...},
#  'nam_oth_www': {...},
#  'nam_pro': {...},
#  'nam_pro_award': {...},
#  'nam_pro_brand': {...},
#  'nam_pro_media': {...},
#  'nam_pro_media_periodic': {...},
#  'nam_pro_media_radio': {...},
#  'nam_pro_media_tv': {...},
#  'nam_pro_media_web': {...},
#  'nam_pro_model_car': {...},
#  'nam_pro_software': {...},
#  'nam_pro_software_game': {...},
#  'nam_pro_title': {...},
#  'nam_pro_title_album': {...},
#  'nam_pro_title_article': {...},
#  'nam_pro_title_book': {...},
#  'nam_pro_title_document': {...},
#  'nam_pro_title_song': {...},
#  'nam_pro_title_treaty': {...},
#  'nam_pro_title_tv': {...},
#  'nam_pro_vehicle': {...},
#  'overall_accuracy': 0.006156203762418094,
#  'overall_f1': 0.0009844258777797407,
#  'overall_precision': 0.0005213624939842789,
#  'overall_recall': 0.008803611738148984}
```