Datasets:

Tasks:
Other
Languages:
Polish
Multilinguality:
monolingual
Size Categories:
18K
10K<n<100K
Language Creators:
found
Annotations Creators:
expert-generated
Source Datasets:
original
Tags:
structure-prediction
License:
kpwr-ner / README.md
julien-c's picture
julien-c HF staff
Fix `license` metadata
16b8428
metadata
annotations_creators:
  - expert-generated
language_creators:
  - found
language:
  - pl
license:
  - 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

Source

Paper

KPWr annotation guidelines

KPWr annotation guidelines - named entities

Examples

Loading

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

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}