IlyaGusev commited on
Commit
659d3b1
1 Parent(s): 563bdc3

Loading script

Browse files
Files changed (2) hide show
  1. dataset_infos.json +454 -0
  2. headline_cause.py +110 -0
dataset_infos.json ADDED
@@ -0,0 +1,454 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "ru_simple": {
3
+ "description": "A Dataset of News Headlines for Detecting Casualties",
4
+ "citation": "\n@misc{gusev2021headlinecause,\n title={HeadlineCause: A Dataset of News Headlines for Detecting Casualties},\n author={Ilya Gusev and Alexey Tikhonov},\n year={2021},\n eprint={2108.12626},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n",
5
+ "homepage": "https://github.com/IlyaGusev/HeadlineCause",
6
+ "license": "",
7
+ "features": {
8
+ "left_url": {
9
+ "dtype": "string",
10
+ "id": null,
11
+ "_type": "Value"
12
+ },
13
+ "right_url": {
14
+ "dtype": "string",
15
+ "id": null,
16
+ "_type": "Value"
17
+ },
18
+ "left_title": {
19
+ "dtype": "string",
20
+ "id": null,
21
+ "_type": "Value"
22
+ },
23
+ "right_title": {
24
+ "dtype": "string",
25
+ "id": null,
26
+ "_type": "Value"
27
+ },
28
+ "left_timestamp": {
29
+ "dtype": "timestamp[s]",
30
+ "id": null,
31
+ "_type": "Value"
32
+ },
33
+ "right_timestamp": {
34
+ "dtype": "timestamp[s]",
35
+ "id": null,
36
+ "_type": "Value"
37
+ },
38
+ "id": {
39
+ "dtype": "string",
40
+ "id": null,
41
+ "_type": "Value"
42
+ },
43
+ "has_link": {
44
+ "dtype": "bool",
45
+ "id": null,
46
+ "_type": "Value"
47
+ },
48
+ "label": {
49
+ "dtype": "int8",
50
+ "id": null,
51
+ "_type": "Value"
52
+ },
53
+ "result": {
54
+ "dtype": "string",
55
+ "id": null,
56
+ "_type": "Value"
57
+ },
58
+ "agreement": {
59
+ "dtype": "float64",
60
+ "id": null,
61
+ "_type": "Value"
62
+ }
63
+ },
64
+ "post_processed": null,
65
+ "supervised_keys": null,
66
+ "task_templates": null,
67
+ "builder_name": "headline_cause_dataset",
68
+ "config_name": "ru_simple",
69
+ "version": {
70
+ "version_str": "1.1.0",
71
+ "description": null,
72
+ "major": 1,
73
+ "minor": 1,
74
+ "patch": 0
75
+ },
76
+ "splits": {
77
+ "train": {
78
+ "name": "train",
79
+ "num_bytes": 3220815,
80
+ "num_examples": 7641,
81
+ "dataset_name": "headline_cause_dataset"
82
+ },
83
+ "test": {
84
+ "name": "test",
85
+ "num_bytes": 399562,
86
+ "num_examples": 957,
87
+ "dataset_name": "headline_cause_dataset"
88
+ },
89
+ "validation": {
90
+ "name": "validation",
91
+ "num_bytes": 413019,
92
+ "num_examples": 955,
93
+ "dataset_name": "headline_cause_dataset"
94
+ }
95
+ },
96
+ "download_checksums": {
97
+ "ru/simple/train.jsonl": {
98
+ "num_bytes": 4383037,
99
+ "checksum": "eb6cf7ef69783a0389b4fc26a7f6910d855c242728fb13afece0b0986f2d0c1a"
100
+ },
101
+ "ru/simple/val.jsonl": {
102
+ "num_bytes": 558303,
103
+ "checksum": "371e1af60a525d53584c4567c9f31c8a067acf36ca638bf4586fea389eaae798"
104
+ },
105
+ "ru/simple/test.jsonl": {
106
+ "num_bytes": 545068,
107
+ "checksum": "40b25679fb3c9e86315fa6c7406f5ab2290200aebbeaf8cf8f2d29d6d872a268"
108
+ }
109
+ },
110
+ "download_size": 5486408,
111
+ "post_processing_size": null,
112
+ "dataset_size": 4033396,
113
+ "size_in_bytes": 9519804
114
+ },
115
+ "en_simple": {
116
+ "description": "A Dataset of News Headlines for Detecting Casualties",
117
+ "citation": "\n@misc{gusev2021headlinecause,\n title={HeadlineCause: A Dataset of News Headlines for Detecting Casualties},\n author={Ilya Gusev and Alexey Tikhonov},\n year={2021},\n eprint={2108.12626},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n",
118
+ "homepage": "https://github.com/IlyaGusev/HeadlineCause",
119
+ "license": "",
120
+ "features": {
121
+ "left_url": {
122
+ "dtype": "string",
123
+ "id": null,
124
+ "_type": "Value"
125
+ },
126
+ "right_url": {
127
+ "dtype": "string",
128
+ "id": null,
129
+ "_type": "Value"
130
+ },
131
+ "left_title": {
132
+ "dtype": "string",
133
+ "id": null,
134
+ "_type": "Value"
135
+ },
136
+ "right_title": {
137
+ "dtype": "string",
138
+ "id": null,
139
+ "_type": "Value"
140
+ },
141
+ "left_timestamp": {
142
+ "dtype": "timestamp[s]",
143
+ "id": null,
144
+ "_type": "Value"
145
+ },
146
+ "right_timestamp": {
147
+ "dtype": "timestamp[s]",
148
+ "id": null,
149
+ "_type": "Value"
150
+ },
151
+ "id": {
152
+ "dtype": "string",
153
+ "id": null,
154
+ "_type": "Value"
155
+ },
156
+ "has_link": {
157
+ "dtype": "bool",
158
+ "id": null,
159
+ "_type": "Value"
160
+ },
161
+ "label": {
162
+ "dtype": "int8",
163
+ "id": null,
164
+ "_type": "Value"
165
+ },
166
+ "result": {
167
+ "dtype": "string",
168
+ "id": null,
169
+ "_type": "Value"
170
+ },
171
+ "agreement": {
172
+ "dtype": "float64",
173
+ "id": null,
174
+ "_type": "Value"
175
+ }
176
+ },
177
+ "post_processed": null,
178
+ "supervised_keys": null,
179
+ "task_templates": null,
180
+ "builder_name": "headline_cause_dataset",
181
+ "config_name": "en_simple",
182
+ "version": {
183
+ "version_str": "1.1.0",
184
+ "description": null,
185
+ "major": 1,
186
+ "minor": 1,
187
+ "patch": 0
188
+ },
189
+ "splits": {
190
+ "train": {
191
+ "name": "train",
192
+ "num_bytes": 1841714,
193
+ "num_examples": 4332,
194
+ "dataset_name": "headline_cause_dataset"
195
+ },
196
+ "test": {
197
+ "name": "test",
198
+ "num_bytes": 230462,
199
+ "num_examples": 542,
200
+ "dataset_name": "headline_cause_dataset"
201
+ },
202
+ "validation": {
203
+ "name": "validation",
204
+ "num_bytes": 224969,
205
+ "num_examples": 542,
206
+ "dataset_name": "headline_cause_dataset"
207
+ }
208
+ },
209
+ "download_checksums": {
210
+ "en/simple/train.jsonl": {
211
+ "num_bytes": 2500156,
212
+ "checksum": "56d52743c1fce590231f21f1ea5f4f7a8126788c3d3bf02270913dc73a13ade0"
213
+ },
214
+ "en/simple/val.jsonl": {
215
+ "num_bytes": 307293,
216
+ "checksum": "56a294418d8e02a0971725bb2b02dc06716d0a10194947dbcc2d477428c23f84"
217
+ },
218
+ "en/simple/test.jsonl": {
219
+ "num_bytes": 312824,
220
+ "checksum": "2328c60ab30d2df91175571eac3ca2483f4e7f25274d406af26a1f08c8922a56"
221
+ }
222
+ },
223
+ "download_size": 3120273,
224
+ "post_processing_size": null,
225
+ "dataset_size": 2297145,
226
+ "size_in_bytes": 5417418
227
+ },
228
+ "ru_full": {
229
+ "description": "A Dataset of News Headlines for Detecting Casualties",
230
+ "citation": "\n@misc{gusev2021headlinecause,\n title={HeadlineCause: A Dataset of News Headlines for Detecting Casualties},\n author={Ilya Gusev and Alexey Tikhonov},\n year={2021},\n eprint={2108.12626},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n",
231
+ "homepage": "https://github.com/IlyaGusev/HeadlineCause",
232
+ "license": "",
233
+ "features": {
234
+ "left_url": {
235
+ "dtype": "string",
236
+ "id": null,
237
+ "_type": "Value"
238
+ },
239
+ "right_url": {
240
+ "dtype": "string",
241
+ "id": null,
242
+ "_type": "Value"
243
+ },
244
+ "left_title": {
245
+ "dtype": "string",
246
+ "id": null,
247
+ "_type": "Value"
248
+ },
249
+ "right_title": {
250
+ "dtype": "string",
251
+ "id": null,
252
+ "_type": "Value"
253
+ },
254
+ "left_timestamp": {
255
+ "dtype": "timestamp[s]",
256
+ "id": null,
257
+ "_type": "Value"
258
+ },
259
+ "right_timestamp": {
260
+ "dtype": "timestamp[s]",
261
+ "id": null,
262
+ "_type": "Value"
263
+ },
264
+ "id": {
265
+ "dtype": "string",
266
+ "id": null,
267
+ "_type": "Value"
268
+ },
269
+ "has_link": {
270
+ "dtype": "bool",
271
+ "id": null,
272
+ "_type": "Value"
273
+ },
274
+ "label": {
275
+ "dtype": "int8",
276
+ "id": null,
277
+ "_type": "Value"
278
+ },
279
+ "result": {
280
+ "dtype": "string",
281
+ "id": null,
282
+ "_type": "Value"
283
+ },
284
+ "agreement": {
285
+ "dtype": "float64",
286
+ "id": null,
287
+ "_type": "Value"
288
+ }
289
+ },
290
+ "post_processed": null,
291
+ "supervised_keys": null,
292
+ "task_templates": null,
293
+ "builder_name": "headline_cause_dataset",
294
+ "config_name": "ru_full",
295
+ "version": {
296
+ "version_str": "1.1.0",
297
+ "description": null,
298
+ "major": 1,
299
+ "minor": 1,
300
+ "patch": 0
301
+ },
302
+ "splits": {
303
+ "train": {
304
+ "name": "train",
305
+ "num_bytes": 2374944,
306
+ "num_examples": 5713,
307
+ "dataset_name": "headline_cause_dataset"
308
+ },
309
+ "test": {
310
+ "name": "test",
311
+ "num_bytes": 294328,
312
+ "num_examples": 715,
313
+ "dataset_name": "headline_cause_dataset"
314
+ },
315
+ "validation": {
316
+ "name": "validation",
317
+ "num_bytes": 305465,
318
+ "num_examples": 715,
319
+ "dataset_name": "headline_cause_dataset"
320
+ }
321
+ },
322
+ "download_checksums": {
323
+ "ru/full/train.jsonl": {
324
+ "num_bytes": 3243725,
325
+ "checksum": "57e8b029aeb9ddeb8f78c9caae992ac9444158c3f6b39714bab342ece051e938"
326
+ },
327
+ "ru/full/val.jsonl": {
328
+ "num_bytes": 414181,
329
+ "checksum": "3aca2c5f4f9a410e5e85deaa9892e6e17c331c3d1cde8ab954ecbfde4f9c5337"
330
+ },
331
+ "ru/full/test.jsonl": {
332
+ "num_bytes": 403090,
333
+ "checksum": "b6acfef1c3d911aaed538322fadf424cdd579a5268b5104908edc3a94db350b4"
334
+ }
335
+ },
336
+ "download_size": 4060996,
337
+ "post_processing_size": null,
338
+ "dataset_size": 2974737,
339
+ "size_in_bytes": 7035733
340
+ },
341
+ "en_full": {
342
+ "description": "A Dataset of News Headlines for Detecting Casualties",
343
+ "citation": "\n@misc{gusev2021headlinecause,\n title={HeadlineCause: A Dataset of News Headlines for Detecting Casualties},\n author={Ilya Gusev and Alexey Tikhonov},\n year={2021},\n eprint={2108.12626},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n",
344
+ "homepage": "https://github.com/IlyaGusev/HeadlineCause",
345
+ "license": "",
346
+ "features": {
347
+ "left_url": {
348
+ "dtype": "string",
349
+ "id": null,
350
+ "_type": "Value"
351
+ },
352
+ "right_url": {
353
+ "dtype": "string",
354
+ "id": null,
355
+ "_type": "Value"
356
+ },
357
+ "left_title": {
358
+ "dtype": "string",
359
+ "id": null,
360
+ "_type": "Value"
361
+ },
362
+ "right_title": {
363
+ "dtype": "string",
364
+ "id": null,
365
+ "_type": "Value"
366
+ },
367
+ "left_timestamp": {
368
+ "dtype": "timestamp[s]",
369
+ "id": null,
370
+ "_type": "Value"
371
+ },
372
+ "right_timestamp": {
373
+ "dtype": "timestamp[s]",
374
+ "id": null,
375
+ "_type": "Value"
376
+ },
377
+ "id": {
378
+ "dtype": "string",
379
+ "id": null,
380
+ "_type": "Value"
381
+ },
382
+ "has_link": {
383
+ "dtype": "bool",
384
+ "id": null,
385
+ "_type": "Value"
386
+ },
387
+ "label": {
388
+ "dtype": "int8",
389
+ "id": null,
390
+ "_type": "Value"
391
+ },
392
+ "result": {
393
+ "dtype": "string",
394
+ "id": null,
395
+ "_type": "Value"
396
+ },
397
+ "agreement": {
398
+ "dtype": "float64",
399
+ "id": null,
400
+ "_type": "Value"
401
+ }
402
+ },
403
+ "post_processed": null,
404
+ "supervised_keys": null,
405
+ "task_templates": null,
406
+ "builder_name": "headline_cause_dataset",
407
+ "config_name": "en_full",
408
+ "version": {
409
+ "version_str": "1.1.0",
410
+ "description": null,
411
+ "major": 1,
412
+ "minor": 1,
413
+ "patch": 0
414
+ },
415
+ "splits": {
416
+ "train": {
417
+ "name": "train",
418
+ "num_bytes": 852680,
419
+ "num_examples": 2009,
420
+ "dataset_name": "headline_cause_dataset"
421
+ },
422
+ "test": {
423
+ "name": "test",
424
+ "num_bytes": 105996,
425
+ "num_examples": 252,
426
+ "dataset_name": "headline_cause_dataset"
427
+ },
428
+ "validation": {
429
+ "name": "validation",
430
+ "num_bytes": 103405,
431
+ "num_examples": 251,
432
+ "dataset_name": "headline_cause_dataset"
433
+ }
434
+ },
435
+ "download_checksums": {
436
+ "en/full/train.jsonl": {
437
+ "num_bytes": 1158002,
438
+ "checksum": "2144a7107247058d18ea4bcf1b557ed4bc073fe350f9dd90543fb79db40c050c"
439
+ },
440
+ "en/full/val.jsonl": {
441
+ "num_bytes": 141511,
442
+ "checksum": "6b7914781c38931fc888d68c0972ad9d920439665ea174dc680d39fe4b18562c"
443
+ },
444
+ "en/full/test.jsonl": {
445
+ "num_bytes": 144284,
446
+ "checksum": "3d3126472493680a1ccad3f11043b884d061712e09763296853bcefd7ffca2a5"
447
+ }
448
+ },
449
+ "download_size": 1443797,
450
+ "post_processing_size": null,
451
+ "dataset_size": 1062081,
452
+ "size_in_bytes": 2505878
453
+ }
454
+ }
headline_cause.py ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2021 The HuggingFace Datasets Authors and Ilya Gusev
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
+ """HeadlineCause: A Dataset of News Headlines for Detecting Casualties"""
16
+
17
+ import json
18
+ import os
19
+
20
+ import datasets
21
+
22
+
23
+ _CITATION = """
24
+ @misc{gusev2021headlinecause,
25
+ title={HeadlineCause: A Dataset of News Headlines for Detecting Casualties},
26
+ author={Ilya Gusev and Alexey Tikhonov},
27
+ year={2021},
28
+ eprint={2108.12626},
29
+ archivePrefix={arXiv},
30
+ primaryClass={cs.CL}
31
+ }
32
+ """
33
+
34
+ _DESCRIPTION = "A Dataset of News Headlines for Detecting Casualties"
35
+ _HOMEPAGE = "https://github.com/IlyaGusev/HeadlineCause"
36
+ _URLS = {
37
+ "ru_simple": {
38
+ "train": "ru/simple/train.jsonl",
39
+ "val": "ru/simple/val.jsonl",
40
+ "test": "ru/simple/test.jsonl"
41
+ },
42
+ "ru_full": {
43
+ "train": "ru/full/train.jsonl",
44
+ "val": "ru/full/val.jsonl",
45
+ "test": "ru/full/test.jsonl"
46
+ },
47
+ "en_simple": {
48
+ "train": "en/simple/train.jsonl",
49
+ "val": "en/simple/val.jsonl",
50
+ "test": "en/simple/test.jsonl"
51
+ },
52
+ "en_full": {
53
+ "train": "en/full/train.jsonl",
54
+ "val": "en/full/val.jsonl",
55
+ "test": "en/full/test.jsonl",
56
+ }
57
+ }
58
+
59
+
60
+ class HeadlineCauseDataset(datasets.GeneratorBasedBuilder):
61
+ """HeadlineCause Dataset"""
62
+
63
+ VERSION = datasets.Version("1.1.0")
64
+
65
+ BUILDER_CONFIGS = [
66
+ datasets.BuilderConfig(name="ru_simple", version=VERSION, description="Russian language, Simple task"),
67
+ datasets.BuilderConfig(name="en_simple", version=VERSION, description="English language, Simple task"),
68
+ datasets.BuilderConfig(name="ru_full", version=VERSION, description="Russian language, Full task"),
69
+ datasets.BuilderConfig(name="en_full", version=VERSION, description="English language, Full task"),
70
+ ]
71
+
72
+ DEFAULT_CONFIG_NAME = "en_simple"
73
+
74
+ def _info(self):
75
+ features = datasets.Features(
76
+ {
77
+ "left_url": datasets.Value("string"),
78
+ "right_url": datasets.Value("string"),
79
+ "left_title": datasets.Value("string"),
80
+ "right_title": datasets.Value("string"),
81
+ "left_timestamp": datasets.Value("timestamp[s]"),
82
+ "right_timestamp": datasets.Value("timestamp[s]"),
83
+ "id": datasets.Value("string"),
84
+ "has_link": datasets.Value("bool"),
85
+ "label": datasets.Value("int8"),
86
+ "result": datasets.Value("string"),
87
+ "agreement": datasets.Value("double")
88
+ }
89
+ )
90
+ return datasets.DatasetInfo(
91
+ description=_DESCRIPTION,
92
+ features=features,
93
+ supervised_keys=None,
94
+ homepage=_HOMEPAGE,
95
+ citation=_CITATION,
96
+ )
97
+
98
+ def _split_generators(self, dl_manager):
99
+ downloaded_files = dl_manager.download_and_extract(_URLS[self.config.name])
100
+ return [
101
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
102
+ datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
103
+ datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["val"]}),
104
+ ]
105
+
106
+ def _generate_examples(self, filepath):
107
+ with open(filepath, encoding="utf-8") as f:
108
+ for row in f:
109
+ data = json.loads(row)
110
+ yield data["id"], data