parquet-converter commited on
Commit
d3a20fa
1 Parent(s): 6fd17a2

Update parquet files

Browse files
.gitattributes CHANGED
@@ -15,3 +15,4 @@
15
  *.pt filter=lfs diff=lfs merge=lfs -text
16
  *.pth filter=lfs diff=lfs merge=lfs -text
17
  *.iob filter=lfs diff=lfs merge=lfs -text
 
 
15
  *.pt filter=lfs diff=lfs merge=lfs -text
16
  *.pth filter=lfs diff=lfs merge=lfs -text
17
  *.iob filter=lfs diff=lfs merge=lfs -text
18
+ default/kpwr-ner-train.parquet filter=lfs diff=lfs merge=lfs -text
README.md DELETED
@@ -1,329 +0,0 @@
1
- ---
2
- annotations_creators:
3
- - expert-generated
4
- language_creators:
5
- - found
6
- language:
7
- - pl
8
- license:
9
- - cc-by-3.0
10
- multilinguality:
11
- - monolingual
12
- pretty_name: 'KPWr-NER'
13
- size_categories:
14
- - 18K
15
- - 10K<n<100K
16
- source_datasets:
17
- - original
18
- task_categories:
19
- - structure-prediction
20
- task_ids:
21
- - named-entity-recognition
22
- ---
23
-
24
- # KPWR-NER
25
-
26
- ## Description
27
-
28
- 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.
29
-
30
- ## Tasks (input, output and metrics)
31
- Named entity recognition (NER) - tagging entities in text with their corresponding type.
32
-
33
- **Input** ('*tokens'* column): sequence of tokens
34
-
35
- **Output** ('*ner'* column): sequence of predicted tokens’ classes in BIO notation (82 possible classes, described in detail in the annotation guidelines)
36
-
37
- **Measurements**: F1-score (seqeval)
38
-
39
- **Example**:
40
-
41
- Input: `[‘Roboty’, ‘mają’, ‘kilkanaście’, ‘lat’, ‘i’, ‘pochodzą’, ‘z’, ‘USA’, ‘,’, ‘Wysokie’, ‘napięcie’, ‘jest’, ‘dużo’, ‘młodsze’, ‘,’, ‘powstało’, ‘w’, ‘Niemczech’, ‘.’]`
42
-
43
- Input (translated by DeepL): `Robots are more than a dozen years old and come from the US, High Voltage is much younger, having been developed in Germany.`
44
-
45
- Output: `[‘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’]`
46
-
47
- ## Data splits
48
-
49
-
50
- | Subset | Cardinality (sentences) |
51
- |--------|------------------------:|
52
- | train | 13959 |
53
- | dev | 0 |
54
- | test | 4323 |
55
-
56
- ## Class distribution (without "O" and "I-*")
57
-
58
- | Class | train | validation | test |
59
- |:----------------------------|--------:|-------------:|----------:|
60
- | B-nam_liv_person | 0.21910 | - | 0.21422 |
61
- | B-nam_loc_gpe_city | 0.10101 | - | 0.09865 |
62
- | B-nam_loc_gpe_country | 0.07467 | - | 0.08059 |
63
- | B-nam_org_institution | 0.05893 | - | 0.06005 |
64
- | B-nam_org_organization | 0.04448 | - | 0.05553 |
65
- | B-nam_org_group_team | 0.03492 | - | 0.03363 |
66
- | B-nam_adj_country | 0.03410 | - | 0.03747 |
67
- | B-nam_org_company | 0.02439 | - | 0.01716 |
68
- | B-nam_pro_media_periodic | 0.02250 | - | 0.01896 |
69
- | B-nam_fac_road | 0.01995 | - | 0.02144 |
70
- | B-nam_liv_god | 0.01934 | - | 0.00790 |
71
- | B-nam_org_nation | 0.01739 | - | 0.01828 |
72
- | B-nam_oth_tech | 0.01724 | - | 0.01377 |
73
- | B-nam_pro_media_web | 0.01709 | - | 0.00903 |
74
- | B-nam_fac_goe | 0.01596 | - | 0.01445 |
75
- | B-nam_eve_human | 0.01573 | - | 0.01761 |
76
- | B-nam_pro_title | 0.01558 | - | 0.00790 |
77
- | B-nam_pro_brand | 0.01543 | - | 0.01038 |
78
- | B-nam_org_political_party | 0.01264 | - | 0.01309 |
79
- | B-nam_loc_gpe_admin1 | 0.01219 | - | 0.01445 |
80
- | B-nam_eve_human_sport | 0.01174 | - | 0.01242 |
81
- | B-nam_pro_software | 0.01091 | - | 0.02190 |
82
- | B-nam_adj | 0.00963 | - | 0.01174 |
83
- | B-nam_loc_gpe_admin3 | 0.00888 | - | 0.01061 |
84
- | B-nam_pro_model_car | 0.00873 | - | 0.00587 |
85
- | B-nam_loc_hydronym_river | 0.00843 | - | 0.01151 |
86
- | B-nam_oth | 0.00775 | - | 0.00497 |
87
- | B-nam_pro_title_document | 0.00738 | - | 0.01986 |
88
- | B-nam_loc_astronomical | 0.00730 | - | - |
89
- | B-nam_oth_currency | 0.00723 | - | 0.01151 |
90
- | B-nam_adj_city | 0.00670 | - | 0.00948 |
91
- | B-nam_org_group_band | 0.00587 | - | 0.00429 |
92
- | B-nam_loc_gpe_admin2 | 0.00565 | - | 0.00813 |
93
- | B-nam_loc_gpe_district | 0.00504 | - | 0.00406 |
94
- | B-nam_loc_land_continent | 0.00459 | - | 0.00722 |
95
- | B-nam_loc_country_region | 0.00459 | - | 0.00090 |
96
- | B-nam_loc_land_mountain | 0.00414 | - | 0.00203 |
97
- | B-nam_pro_title_book | 0.00384 | - | 0.00248 |
98
- | B-nam_loc_historical_region | 0.00376 | - | 0.00497 |
99
- | B-nam_loc | 0.00361 | - | 0.00090 |
100
- | B-nam_eve | 0.00361 | - | 0.00181 |
101
- | B-nam_org_group | 0.00331 | - | 0.00406 |
102
- | B-nam_loc_land_island | 0.00331 | - | 0.00248 |
103
- | B-nam_pro_media_tv | 0.00316 | - | 0.00158 |
104
- | B-nam_liv_habitant | 0.00316 | - | 0.00158 |
105
- | B-nam_eve_human_cultural | 0.00316 | - | 0.00497 |
106
- | B-nam_pro_title_tv | 0.00309 | - | 0.00542 |
107
- | B-nam_oth_license | 0.00286 | - | 0.00248 |
108
- | B-nam_num_house | 0.00256 | - | 0.00248 |
109
- | B-nam_pro_title_treaty | 0.00248 | - | 0.00045 |
110
- | B-nam_fac_system | 0.00248 | - | 0.00587 |
111
- | B-nam_loc_gpe_subdivision | 0.00241 | - | 0.00587 |
112
- | B-nam_loc_land_region | 0.00226 | - | 0.00248 |
113
- | B-nam_pro_title_album | 0.00218 | - | 0.00158 |
114
- | B-nam_adj_person | 0.00203 | - | 0.00406 |
115
- | B-nam_fac_square | 0.00196 | - | 0.00135 |
116
- | B-nam_pro_award | 0.00188 | - | 0.00519 |
117
- | B-nam_eve_human_holiday | 0.00188 | - | 0.00203 |
118
- | B-nam_pro_title_song | 0.00166 | - | 0.00158 |
119
- | B-nam_pro_media_radio | 0.00151 | - | 0.00068 |
120
- | B-nam_pro_vehicle | 0.00151 | - | 0.00090 |
121
- | B-nam_oth_position | 0.00143 | - | 0.00226 |
122
- | B-nam_liv_animal | 0.00143 | - | 0.00248 |
123
- | B-nam_pro | 0.00135 | - | 0.00045 |
124
- | B-nam_oth_www | 0.00120 | - | 0.00451 |
125
- | B-nam_num_phone | 0.00120 | - | 0.00045 |
126
- | B-nam_pro_title_article | 0.00113 | - | - |
127
- | B-nam_oth_data_format | 0.00113 | - | 0.00226 |
128
- | B-nam_fac_bridge | 0.00105 | - | 0.00090 |
129
- | B-nam_liv_character | 0.00098 | - | - |
130
- | B-nam_pro_software_game | 0.00090 | - | 0.00068 |
131
- | B-nam_loc_hydronym_lake | 0.00090 | - | 0.00045 |
132
- | B-nam_loc_gpe_conurbation | 0.00090 | - | - |
133
- | B-nam_pro_media | 0.00083 | - | 0.00181 |
134
- | B-nam_loc_land | 0.00075 | - | 0.00045 |
135
- | B-nam_loc_land_peak | 0.00075 | - | - |
136
- | B-nam_fac_park | 0.00068 | - | 0.00226 |
137
- | B-nam_org_organization_sub | 0.00060 | - | 0.00068 |
138
- | B-nam_loc_hydronym | 0.00060 | - | 0.00023 |
139
- | B-nam_loc_hydronym_sea | 0.00045 | - | 0.00068 |
140
- | B-nam_loc_hydronym_ocean | 0.00045 | - | 0.00023 |
141
- | B-nam_fac_goe_stop | 0.00038 | - | 0.00090 |
142
-
143
-
144
- ## Citation
145
-
146
- ```
147
- @inproceedings{broda-etal-2012-kpwr,
148
- title = "{KPW}r: Towards a Free Corpus of {P}olish",
149
- author = "Broda, Bartosz and
150
- Marci{\'n}czuk, Micha{\l} and
151
- Maziarz, Marek and
152
- Radziszewski, Adam and
153
- Wardy{\'n}ski, Adam",
154
- booktitle = "Proceedings of the Eighth International Conference on Language Resources and Evaluation ({LREC}'12)",
155
- month = may,
156
- year = "2012",
157
- address = "Istanbul, Turkey",
158
- publisher = "European Language Resources Association (ELRA)",
159
- url = "http://www.lrec-conf.org/proceedings/lrec2012/pdf/965_Paper.pdf",
160
- pages = "3218--3222",
161
- 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.",
162
- }
163
- ```
164
-
165
- ## License
166
-
167
- ```
168
- Creative Commons Attribution 3.0 Unported Licence
169
- ```
170
-
171
- ## Links
172
-
173
- [HuggingFace](https://huggingface.co/datasets/clarin-pl/kpwr-ner)
174
-
175
- [Source](https://clarin-pl.eu/index.php/kpwr-en/)
176
-
177
- [Paper](https://aclanthology.org/L12-1574/)
178
-
179
- [KPWr annotation guidelines](http://www.nlp.pwr.wroc.pl/narzedzia-i-zasoby/zasoby/kpwr-lemma/16-narzedzia-zasoby/79-wytyczne)
180
-
181
- [KPWr annotation guidelines - named entities](https://clarin-pl.eu/dspace/handle/11321/294)
182
-
183
- ## Examples
184
-
185
- ### Loading
186
-
187
- ```python
188
- from pprint import pprint
189
-
190
- from datasets import load_dataset
191
-
192
- dataset = load_dataset("clarin-pl/kpwr-ner")
193
- pprint(dataset['train'][0])
194
-
195
- # {'lemmas': ['roborally', 'czy', 'wysoki', 'napięcie', '?'],
196
- # 'ner': [73, 160, 73, 151, 160],
197
- # 'orth': ['subst:sg:nom:n',
198
- # 'qub',
199
- # 'adj:sg:nom:n:pos',
200
- # 'subst:sg:nom:n',
201
- # 'interp'],
202
- # 'tokens': ['RoboRally', 'czy', 'Wysokie', 'napięcie', '?']}
203
- ```
204
-
205
- ### Evaluation
206
-
207
- ```python
208
- import random
209
- from pprint import pprint
210
-
211
- from datasets import load_dataset, load_metric
212
-
213
- dataset = load_dataset("clarin-pl/kpwr-ner")
214
- references = dataset["test"]["ner"]
215
-
216
- # generate random predictions
217
- predictions = [
218
- [
219
- random.randrange(dataset["train"].features["ner"].feature.num_classes)
220
- for _ in range(len(labels))
221
- ]
222
- for labels in references
223
- ]
224
-
225
- # transform to original names of labels
226
- references_named = [
227
- [dataset["train"].features["ner"].feature.names[label] for label in labels]
228
- for labels in references
229
- ]
230
- predictions_named = [
231
- [dataset["train"].features["ner"].feature.names[label] for label in labels]
232
- for labels in predictions
233
- ]
234
-
235
- # utilise seqeval to evaluate
236
- seqeval = load_metric("seqeval")
237
- seqeval_score = seqeval.compute(
238
- predictions=predictions_named, references=references_named, scheme="IOB2"
239
- )
240
-
241
- pprint(seqeval_score, depth=1)
242
-
243
- # {'nam_adj': {...},
244
- # 'nam_adj_city': {...},
245
- # 'nam_adj_country': {...},
246
- # 'nam_adj_person': {...},
247
- # 'nam_eve': {...},
248
- # 'nam_eve_human': {...},
249
- # 'nam_eve_human_cultural': {...},
250
- # 'nam_eve_human_holiday': {...},
251
- # 'nam_eve_human_sport': {...},
252
- # 'nam_fac_bridge': {...},
253
- # 'nam_fac_goe': {...},
254
- # 'nam_fac_goe_stop': {...},
255
- # 'nam_fac_park': {...},
256
- # 'nam_fac_road': {...},
257
- # 'nam_fac_square': {...},
258
- # 'nam_fac_system': {...},
259
- # 'nam_liv_animal': {...},
260
- # 'nam_liv_character': {...},
261
- # 'nam_liv_god': {...},
262
- # 'nam_liv_habitant': {...},
263
- # 'nam_liv_person': {...},
264
- # 'nam_loc': {...},
265
- # 'nam_loc_astronomical': {...},
266
- # 'nam_loc_country_region': {...},
267
- # 'nam_loc_gpe_admin1': {...},
268
- # 'nam_loc_gpe_admin2': {...},
269
- # 'nam_loc_gpe_admin3': {...},
270
- # 'nam_loc_gpe_city': {...},
271
- # 'nam_loc_gpe_conurbation': {...},
272
- # 'nam_loc_gpe_country': {...},
273
- # 'nam_loc_gpe_district': {...},
274
- # 'nam_loc_gpe_subdivision': {...},
275
- # 'nam_loc_historical_region': {...},
276
- # 'nam_loc_hydronym': {...},
277
- # 'nam_loc_hydronym_lake': {...},
278
- # 'nam_loc_hydronym_ocean': {...},
279
- # 'nam_loc_hydronym_river': {...},
280
- # 'nam_loc_hydronym_sea': {...},
281
- # 'nam_loc_land': {...},
282
- # 'nam_loc_land_continent': {...},
283
- # 'nam_loc_land_island': {...},
284
- # 'nam_loc_land_mountain': {...},
285
- # 'nam_loc_land_peak': {...},
286
- # 'nam_loc_land_region': {...},
287
- # 'nam_num_house': {...},
288
- # 'nam_num_phone': {...},
289
- # 'nam_org_company': {...},
290
- # 'nam_org_group': {...},
291
- # 'nam_org_group_band': {...},
292
- # 'nam_org_group_team': {...},
293
- # 'nam_org_institution': {...},
294
- # 'nam_org_nation': {...},
295
- # 'nam_org_organization': {...},
296
- # 'nam_org_organization_sub': {...},
297
- # 'nam_org_political_party': {...},
298
- # 'nam_oth': {...},
299
- # 'nam_oth_currency': {...},
300
- # 'nam_oth_data_format': {...},
301
- # 'nam_oth_license': {...},
302
- # 'nam_oth_position': {...},
303
- # 'nam_oth_tech': {...},
304
- # 'nam_oth_www': {...},
305
- # 'nam_pro': {...},
306
- # 'nam_pro_award': {...},
307
- # 'nam_pro_brand': {...},
308
- # 'nam_pro_media': {...},
309
- # 'nam_pro_media_periodic': {...},
310
- # 'nam_pro_media_radio': {...},
311
- # 'nam_pro_media_tv': {...},
312
- # 'nam_pro_media_web': {...},
313
- # 'nam_pro_model_car': {...},
314
- # 'nam_pro_software': {...},
315
- # 'nam_pro_software_game': {...},
316
- # 'nam_pro_title': {...},
317
- # 'nam_pro_title_album': {...},
318
- # 'nam_pro_title_article': {...},
319
- # 'nam_pro_title_book': {...},
320
- # 'nam_pro_title_document': {...},
321
- # 'nam_pro_title_song': {...},
322
- # 'nam_pro_title_treaty': {...},
323
- # 'nam_pro_title_tv': {...},
324
- # 'nam_pro_vehicle': {...},
325
- # 'overall_accuracy': 0.006156203762418094,
326
- # 'overall_f1': 0.0009844258777797407,
327
- # 'overall_precision': 0.0005213624939842789,
328
- # 'overall_recall': 0.008803611738148984}
329
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/kpwr-ner-n82-test.iob DELETED
The diff for this file is too large to render. See raw diff
 
data/kpwr-ner-n82-train-tune.iob DELETED
The diff for this file is too large to render. See raw diff
 
default/kpwr-ner-test.parquet ADDED
Binary file (778 kB). View file
 
default/kpwr-ner-train.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:604385abf5db47d7c9c5a19bca3d13508d0e212aa155b80725ca9738fc5cddd7
3
+ size 2312782
kpwr-ner.py DELETED
@@ -1,266 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2021 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
-
16
- # Lint as: python3
17
- """KPWR-NER tagging dataset."""
18
-
19
- import csv
20
- from typing import List, Tuple, Dict, Generator
21
-
22
- import datasets
23
-
24
- _DESCRIPTION = """KPWR-NER tagging dataset."""
25
-
26
- _URLS = {
27
- "train": "https://huggingface.co/datasets/clarin-pl/kpwr-ner/resolve/main/data/kpwr-ner-n82-train-tune.iob",
28
- "test": "https://huggingface.co/datasets/clarin-pl/kpwr-ner/resolve/main/data/kpwr-ner-n82-test.iob",
29
- }
30
-
31
- _HOMEPAGE = "https://clarin-pl.eu/dspace/handle/11321/294"
32
-
33
- _NER_TAGS = [
34
- "B-nam_adj",
35
- "B-nam_adj_city",
36
- "B-nam_adj_country",
37
- "B-nam_adj_person",
38
- "B-nam_eve",
39
- "B-nam_eve_human",
40
- "B-nam_eve_human_cultural",
41
- "B-nam_eve_human_holiday",
42
- "B-nam_eve_human_sport",
43
- "B-nam_fac_bridge",
44
- "B-nam_fac_goe",
45
- "B-nam_fac_goe_stop",
46
- "B-nam_fac_park",
47
- "B-nam_fac_road",
48
- "B-nam_fac_square",
49
- "B-nam_fac_system",
50
- "B-nam_liv_animal",
51
- "B-nam_liv_character",
52
- "B-nam_liv_god",
53
- "B-nam_liv_habitant",
54
- "B-nam_liv_person",
55
- "B-nam_loc",
56
- "B-nam_loc_astronomical",
57
- "B-nam_loc_country_region",
58
- "B-nam_loc_gpe_admin1",
59
- "B-nam_loc_gpe_admin2",
60
- "B-nam_loc_gpe_admin3",
61
- "B-nam_loc_gpe_city",
62
- "B-nam_loc_gpe_conurbation",
63
- "B-nam_loc_gpe_country",
64
- "B-nam_loc_gpe_district",
65
- "B-nam_loc_gpe_subdivision",
66
- "B-nam_loc_historical_region",
67
- "B-nam_loc_hydronym",
68
- "B-nam_loc_hydronym_lake",
69
- "B-nam_loc_hydronym_ocean",
70
- "B-nam_loc_hydronym_river",
71
- "B-nam_loc_hydronym_sea",
72
- "B-nam_loc_land",
73
- "B-nam_loc_land_continent",
74
- "B-nam_loc_land_island",
75
- "B-nam_loc_land_mountain",
76
- "B-nam_loc_land_peak",
77
- "B-nam_loc_land_region",
78
- "B-nam_num_house",
79
- "B-nam_num_phone",
80
- "B-nam_org_company",
81
- "B-nam_org_group",
82
- "B-nam_org_group_band",
83
- "B-nam_org_group_team",
84
- "B-nam_org_institution",
85
- "B-nam_org_nation",
86
- "B-nam_org_organization",
87
- "B-nam_org_organization_sub",
88
- "B-nam_org_political_party",
89
- "B-nam_oth",
90
- "B-nam_oth_currency",
91
- "B-nam_oth_data_format",
92
- "B-nam_oth_license",
93
- "B-nam_oth_position",
94
- "B-nam_oth_tech",
95
- "B-nam_oth_www",
96
- "B-nam_pro",
97
- "B-nam_pro_award",
98
- "B-nam_pro_brand",
99
- "B-nam_pro_media",
100
- "B-nam_pro_media_periodic",
101
- "B-nam_pro_media_radio",
102
- "B-nam_pro_media_tv",
103
- "B-nam_pro_media_web",
104
- "B-nam_pro_model_car",
105
- "B-nam_pro_software",
106
- "B-nam_pro_software_game",
107
- "B-nam_pro_title",
108
- "B-nam_pro_title_album",
109
- "B-nam_pro_title_article",
110
- "B-nam_pro_title_book",
111
- "B-nam_pro_title_document",
112
- "B-nam_pro_title_song",
113
- "B-nam_pro_title_treaty",
114
- "B-nam_pro_title_tv",
115
- "B-nam_pro_vehicle",
116
- "I-nam_adj_country",
117
- "I-nam_eve",
118
- "I-nam_eve_human",
119
- "I-nam_eve_human_cultural",
120
- "I-nam_eve_human_holiday",
121
- "I-nam_eve_human_sport",
122
- "I-nam_fac_bridge",
123
- "I-nam_fac_goe",
124
- "I-nam_fac_goe_stop",
125
- "I-nam_fac_park",
126
- "I-nam_fac_road",
127
- "I-nam_fac_square",
128
- "I-nam_fac_system",
129
- "I-nam_liv_animal",
130
- "I-nam_liv_character",
131
- "I-nam_liv_god",
132
- "I-nam_liv_person",
133
- "I-nam_loc",
134
- "I-nam_loc_astronomical",
135
- "I-nam_loc_country_region",
136
- "I-nam_loc_gpe_admin1",
137
- "I-nam_loc_gpe_admin2",
138
- "I-nam_loc_gpe_admin3",
139
- "I-nam_loc_gpe_city",
140
- "I-nam_loc_gpe_conurbation",
141
- "I-nam_loc_gpe_country",
142
- "I-nam_loc_gpe_district",
143
- "I-nam_loc_gpe_subdivision",
144
- "I-nam_loc_historical_region",
145
- "I-nam_loc_hydronym",
146
- "I-nam_loc_hydronym_lake",
147
- "I-nam_loc_hydronym_ocean",
148
- "I-nam_loc_hydronym_river",
149
- "I-nam_loc_hydronym_sea",
150
- "I-nam_loc_land",
151
- "I-nam_loc_land_continent",
152
- "I-nam_loc_land_island",
153
- "I-nam_loc_land_mountain",
154
- "I-nam_loc_land_peak",
155
- "I-nam_loc_land_region",
156
- "I-nam_num_house",
157
- "I-nam_num_phone",
158
- "I-nam_org_company",
159
- "I-nam_org_group",
160
- "I-nam_org_group_band",
161
- "I-nam_org_group_team",
162
- "I-nam_org_institution",
163
- "I-nam_org_nation",
164
- "I-nam_org_organization",
165
- "I-nam_org_organization_sub",
166
- "I-nam_org_political_party",
167
- "I-nam_oth",
168
- "I-nam_oth_currency",
169
- "I-nam_oth_data_format",
170
- "I-nam_oth_license",
171
- "I-nam_oth_position",
172
- "I-nam_oth_tech",
173
- "I-nam_oth_www",
174
- "I-nam_pro",
175
- "I-nam_pro_award",
176
- "I-nam_pro_brand",
177
- "I-nam_pro_media",
178
- "I-nam_pro_media_periodic",
179
- "I-nam_pro_media_radio",
180
- "I-nam_pro_media_tv",
181
- "I-nam_pro_media_web",
182
- "I-nam_pro_model_car",
183
- "I-nam_pro_software",
184
- "I-nam_pro_software_game",
185
- "I-nam_pro_title",
186
- "I-nam_pro_title_album",
187
- "I-nam_pro_title_article",
188
- "I-nam_pro_title_book",
189
- "I-nam_pro_title_document",
190
- "I-nam_pro_title_song",
191
- "I-nam_pro_title_treaty",
192
- "I-nam_pro_title_tv",
193
- "I-nam_pro_vehicle",
194
- "O",
195
- ]
196
-
197
-
198
- class KPWRNER(datasets.GeneratorBasedBuilder):
199
- def _info(self) -> datasets.DatasetInfo:
200
- return datasets.DatasetInfo(
201
- description=_DESCRIPTION,
202
- features=datasets.Features(
203
- {
204
- "tokens": datasets.Sequence(datasets.Value("string")),
205
- "lemmas": datasets.Sequence(datasets.Value("string")),
206
- "orth": datasets.Sequence(datasets.Value("string")),
207
- "ner": datasets.Sequence(
208
- datasets.features.ClassLabel(
209
- names=_NER_TAGS, num_classes=len(_NER_TAGS)
210
- )
211
- ),
212
- }
213
- ),
214
- homepage=_HOMEPAGE,
215
- )
216
-
217
- def _split_generators(
218
- self, dl_manager: datasets.DownloadManager
219
- ) -> List[datasets.SplitGenerator]:
220
- urls_to_download = _URLS
221
- downloaded_files = dl_manager.download_and_extract(urls_to_download)
222
- return [
223
- datasets.SplitGenerator(
224
- name=datasets.Split.TRAIN,
225
- gen_kwargs={"filepath": downloaded_files["train"]},
226
- ),
227
- datasets.SplitGenerator(
228
- name=datasets.Split.TEST,
229
- gen_kwargs={"filepath": downloaded_files["test"]},
230
- ),
231
- ]
232
-
233
- def _generate_examples(
234
- self, filepath: str
235
- ) -> Generator[Tuple[int, Dict[str, str]], None, None]:
236
- with open(filepath, "r", encoding="utf-8") as f:
237
- reader = csv.reader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
238
-
239
- tokens = []
240
- lemma = []
241
- orth = []
242
- ner = []
243
- gid = 0
244
-
245
- for line in reader:
246
- if not line:
247
- yield gid, {
248
- "tokens": tokens,
249
- "lemmas": lemma,
250
- "orth": orth,
251
- "ner": ner,
252
- }
253
- gid += 1
254
- tokens = []
255
- lemma = []
256
- orth = []
257
- ner = []
258
-
259
- elif len(line) == 1: # ignore DOCS
260
- continue
261
-
262
- else:
263
- tokens.append(line[0])
264
- lemma.append(line[1])
265
- orth.append(line[2])
266
- ner.append(line[3])