kpwr-ner / README.md
asawczyn's picture
update class distribution in README.md
aebf75e
|
raw
history blame
18.5 kB
metadata
annotations_creators:
  - expert-generated
language_creators:
  - found
language:
  - pl
license:
  - cc-by-3.0
multilinguality:
  - monolingual
pretty_name: KPWr-NER
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
dev 0
test 4323

Class distribution

Class train dev test
O 0.898080 - 0.895728
B-nam_liv_person 0.012769 - 0.012537
I-nam_liv_person 0.008246 - 0.007160
I-nam_org_institution 0.006448 - 0.005667
B-nam_loc_gpe_city 0.005886 - 0.005773
B-nam_loc_gpe_country 0.004351 - 0.004716
I-nam_org_organization 0.003728 - 0.004214
B-nam_org_institution 0.003434 - 0.003514
I-nam_pro_title_document 0.003206 - 0.005694
B-nam_org_organization 0.002592 - 0.003250
B-nam_org_group_team 0.002035 - 0.001968
B-nam_adj_country 0.001987 - 0.002193
I-nam_org_group_team 0.001851 - 0.002167
I-nam_pro_title 0.001715 - 0.000951
I-nam_eve_human 0.001557 - 0.003844
B-nam_org_company 0.001421 - 0.001004
I-nam_org_company 0.001316 - 0.000423
B-nam_pro_media_periodic 0.001312 - 0.001110
I-nam_fac_goe 0.001285 - 0.000885
I-nam_pro_media_periodic 0.001254 - 0.001480
B-nam_fac_road 0.001162 - 0.001255
B-nam_liv_god 0.001127 - 0.000462
I-nam_eve_human_sport 0.001057 - 0.001321
B-nam_org_nation 0.001013 - 0.001070
B-nam_oth_tech 0.001004 - 0.000806
B-nam_pro_media_web 0.000996 - 0.000528
B-nam_fac_goe 0.000930 - 0.000845
B-nam_eve_human 0.000917 - 0.001030
B-nam_pro_title 0.000908 - 0.000462
B-nam_pro_brand 0.000899 - 0.000608
I-nam_pro_model_car 0.000877 - 0.000489
I-nam_pro_brand 0.000868 - 0.000793
I-nam_loc_gpe_city 0.000847 - 0.000766
B-nam_org_political_party 0.000737 - 0.000766
I-nam_loc_gpe_country 0.000715 - 0.000779
B-nam_loc_gpe_admin1 0.000711 - 0.000845
I-nam_pro_title_treaty 0.000697 - 0.000106
B-nam_eve_human_sport 0.000684 - 0.000727
I-nam_org_political_party 0.000680 - 0.000753
B-nam_pro_software 0.000636 - 0.001281
I-nam_fac_road 0.000623 - 0.000991
B-nam_adj 0.000561 - 0.000687
B-nam_loc_gpe_admin3 0.000518 - 0.000621
B-nam_pro_model_car 0.000509 - 0.000343
B-nam_loc_hydronym_river 0.000491 - 0.000674
B-nam_oth 0.000452 - 0.000291
B-nam_pro_title_document 0.000430 - 0.001163
B-nam_loc_astronomical 0.000425 - -
B-nam_oth_currency 0.000421 - 0.000674
B-nam_adj_city 0.000390 - 0.000555
I-nam_eve 0.000373 - 0.000172
I-nam_org_group_band 0.000364 - 0.000304
B-nam_org_group_band 0.000342 - 0.000251
I-nam_pro_media_web 0.000329 - 0.000357
I-nam_pro_title_book 0.000329 - 0.000119
B-nam_loc_gpe_admin2 0.000329 - 0.000476
I-nam_pro_software 0.000320 - 0.000753
I-nam_eve_human_cultural 0.000298 - 0.000502
I-nam_oth_tech 0.000294 - 0.000251
B-nam_loc_gpe_district 0.000294 - 0.000238
I-nam_oth 0.000285 - 0.000251
B-nam_loc_land_continent 0.000268 - 0.000423
B-nam_loc_country_region 0.000268 - 0.000053
B-nam_loc_land_mountain 0.000241 - 0.000119
I-nam_pro_title_article 0.000228 - -
B-nam_pro_title_book 0.000224 - 0.000145
B-nam_loc_historical_region 0.000219 - 0.000291
B-nam_loc 0.000211 - 0.000053
B-nam_eve 0.000211 - 0.000106
B-nam_org_group 0.000193 - 0.000238
B-nam_loc_land_island 0.000193 - 0.000145
I-nam_pro_title_tv 0.000193 - 0.000449
I-nam_pro_title_album 0.000189 - 0.000185
B-nam_pro_media_tv 0.000184 - 0.000092
B-nam_liv_habitant 0.000184 - 0.000092
B-nam_eve_human_cultural 0.000184 - 0.000291
I-nam_pro_title_song 0.000184 - 0.000198
I-nam_oth_license 0.000180 - 0.000066
B-nam_pro_title_tv 0.000180 - 0.000317
I-nam_oth_position 0.000175 - 0.000343
I-nam_loc_country_region 0.000171 - 0.000066
I-nam_loc_gpe_admin1 0.000171 - 0.000172
B-nam_oth_license 0.000167 - 0.000145
B-nam_num_house 0.000149 - 0.000145
B-nam_pro_title_treaty 0.000145 - 0.000026
B-nam_fac_system 0.000145 - 0.000343
I-nam_loc_gpe_admin3 0.000140 - 0.000172
B-nam_loc_gpe_subdivision 0.000140 - 0.000343
I-nam_eve_human_holiday 0.000136 - 0.000106
I-nam_org_group 0.000136 - 0.000013
B-nam_loc_land_region 0.000132 - 0.000145
I-nam_pro_award 0.000132 - 0.000819
I-nam_loc_land_mountain 0.000132 - 0.000026
I-nam_loc_astronomical 0.000132 - -
B-nam_pro_title_album 0.000127 - 0.000092
I-nam_pro_software_game 0.000123 - 0.000026
B-nam_adj_person 0.000118 - 0.000238
B-nam_fac_square 0.000114 - 0.000079
I-nam_pro_media_radio 0.000114 - 0.000066
B-nam_pro_award 0.000110 - 0.000304
B-nam_eve_human_holiday 0.000110 - 0.000119
I-nam_loc 0.000101 - 0.000013
B-nam_pro_title_song 0.000096 - 0.000092
I-nam_loc_gpe_subdivision 0.000096 - 0.000106
B-nam_pro_media_radio 0.000088 - 0.000040
I-nam_loc_gpe_district 0.000088 - 0.000026
B-nam_pro_vehicle 0.000088 - 0.000053
I-nam_loc_land_island 0.000083 - 0.000106
I-nam_fac_park 0.000083 - 0.000238
B-nam_oth_position 0.000083 - 0.000132
B-nam_liv_animal 0.000083 - 0.000145
I-nam_pro 0.000083 - 0.000066
B-nam_pro 0.000079 - 0.000026
I-nam_loc_historical_region 0.000079 - 0.000040
I-nam_loc_land_region 0.000075 - 0.000053
I-nam_liv_god 0.000075 - 0.000053
I-nam_num_phone 0.000075 - 0.000053
I-nam_fac_bridge 0.000075 - 0.000079
I-nam_pro_media_tv 0.000070 - 0.000040
B-nam_oth_www 0.000070 - 0.000264
B-nam_num_phone 0.000070 - 0.000026
B-nam_pro_title_article 0.000066 - -
B-nam_oth_data_format 0.000066 - 0.000132
B-nam_fac_bridge 0.000061 - 0.000053
B-nam_liv_character 0.000057 - -
I-nam_org_organization_sub 0.000053 - 0.000119
B-nam_pro_software_game 0.000053 - 0.000040
B-nam_loc_hydronym_lake 0.000053 - 0.000026
B-nam_loc_gpe_conurbation 0.000053 - -
B-nam_pro_media 0.000048 - 0.000106
I-nam_fac_square 0.000044 - 0.000106
B-nam_loc_land 0.000044 - 0.000026
B-nam_loc_land_peak 0.000044 - -
B-nam_fac_park 0.000039 - 0.000132
B-nam_org_organization_sub 0.000035 - 0.000040
I-nam_loc_hydronym_lake 0.000035 - 0.000013
B-nam_loc_hydronym 0.000035 - 0.000013
I-nam_pro_vehicle 0.000035 - 0.000053
I-nam_loc_gpe_conurbation 0.000035 - -
I-nam_fac_goe_stop 0.000035 - 0.000040
I-nam_fac_system 0.000031 - 0.000238
I-nam_pro_media 0.000031 - 0.000066
I-nam_loc_gpe_admin2 0.000031 - 0.000066
I-nam_loc_land 0.000026 - 0.000026
B-nam_loc_hydronym_sea 0.000026 - 0.000040
B-nam_loc_hydronym_ocean 0.000026 - 0.000013
I-nam_org_nation 0.000026 - 0.000013
I-nam_liv_character 0.000022 - -
I-nam_oth_www 0.000022 - 0.000040
B-nam_fac_goe_stop 0.000022 - 0.000053
I-nam_loc_hydronym_sea 0.000018 - 0.000013
I-nam_oth_currency 0.000018 - -
I-nam_loc_hydronym 0.000018 - 0.000026
I-nam_liv_animal 0.000018 - -
I-nam_loc_hydronym_river 0.000018 - 0.000053
I-nam_oth_data_format 0.000013 - 0.000053
I-nam_loc_land_continent 0.000009 - 0.000026
I-nam_loc_land_peak 0.000009 - -
I-nam_num_house 0.000009 - -
I-nam_loc_hydronym_ocean 0.000009 - -
I-nam_adj_country - - 0.000026

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}