Commit
•
2e750ac
1
Parent(s):
77ff552
Add dataloading script, meta file and dummy data
Browse files- cnn_dailymail_nl.py +136 -0
- dataset_infos.json +83 -0
- dummy/0.0.0/dummy_data.zip +0 -0
cnn_dailymail_nl.py
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 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 |
+
"""CNN/Dailymail Dutch summarization dataset."""
|
18 |
+
|
19 |
+
|
20 |
+
import csv
|
21 |
+
|
22 |
+
import datasets
|
23 |
+
|
24 |
+
|
25 |
+
_DESCRIPTION = """\
|
26 |
+
This dataset is the CNN/Dailymail dataset translated to Dutch.
|
27 |
+
This is the original dataset:
|
28 |
+
```
|
29 |
+
load_dataset("cnn_dailymail", '3.0.0')
|
30 |
+
```
|
31 |
+
And this is the HuggingFace translation pipeline:
|
32 |
+
```
|
33 |
+
pipeline(
|
34 |
+
task='translation_en_to_nl',
|
35 |
+
model='Helsinki-NLP/opus-mt-en-nl',
|
36 |
+
tokenizer='Helsinki-NLP/opus-mt-en-nl')
|
37 |
+
```
|
38 |
+
"""
|
39 |
+
|
40 |
+
# The second citation introduces the source data, while the first
|
41 |
+
# introduces the specific form (non-anonymized) we use here.
|
42 |
+
_CITATION = """\
|
43 |
+
@article{DBLP:journals/corr/SeeLM17,
|
44 |
+
author = {Abigail See and
|
45 |
+
Peter J. Liu and
|
46 |
+
Christopher D. Manning},
|
47 |
+
title = {Get To The Point: Summarization with Pointer-Generator Networks},
|
48 |
+
journal = {CoRR},
|
49 |
+
volume = {abs/1704.04368},
|
50 |
+
year = {2017},
|
51 |
+
url = {http://arxiv.org/abs/1704.04368},
|
52 |
+
archivePrefix = {arXiv},
|
53 |
+
eprint = {1704.04368},
|
54 |
+
timestamp = {Mon, 13 Aug 2018 16:46:08 +0200},
|
55 |
+
biburl = {https://dblp.org/rec/bib/journals/corr/SeeLM17},
|
56 |
+
bibsource = {dblp computer science bibliography, https://dblp.org}
|
57 |
+
}
|
58 |
+
|
59 |
+
@inproceedings{hermann2015teaching,
|
60 |
+
title={Teaching machines to read and comprehend},
|
61 |
+
author={Hermann, Karl Moritz and Kocisky, Tomas and Grefenstette, Edward and Espeholt, Lasse and Kay, Will and Suleyman, Mustafa and Blunsom, Phil},
|
62 |
+
booktitle={Advances in neural information processing systems},
|
63 |
+
pages={1693--1701},
|
64 |
+
year={2015}
|
65 |
+
}
|
66 |
+
"""
|
67 |
+
|
68 |
+
|
69 |
+
_TRAIN_DOWNLOAD_URLS = [
|
70 |
+
"https://huggingface.co/datasets/ml6team/cnn_dailymail_nl/resolve/main/cnn_dailymail_nl_train_000000000000.csv.gz",
|
71 |
+
"https://huggingface.co/datasets/ml6team/cnn_dailymail_nl/resolve/main/cnn_dailymail_nl_train_000000000001.csv.gz",
|
72 |
+
"https://huggingface.co/datasets/ml6team/cnn_dailymail_nl/resolve/main/cnn_dailymail_nl_train_000000000002.csv.gz",
|
73 |
+
]
|
74 |
+
_VALIDATION_DOWNLOAD_URL = "https://huggingface.co/datasets/ml6team/cnn_dailymail_nl/resolve/main/cnn_dailymail_nl_validation.csv.gz"
|
75 |
+
_TEST_DOWNLOAD_URL = "https://huggingface.co/datasets/ml6team/cnn_dailymail_nl/resolve/main/cnn_dailymail_nl_test.csv.gz"
|
76 |
+
|
77 |
+
|
78 |
+
_ID = "id"
|
79 |
+
_HIGHLIGHTS = "highlights"
|
80 |
+
_ARTICLE = "article"
|
81 |
+
|
82 |
+
|
83 |
+
class CnnDailymailNl(datasets.GeneratorBasedBuilder):
|
84 |
+
"""CNN/Dailymail Dutch summarization dataset."""
|
85 |
+
|
86 |
+
def _info(self):
|
87 |
+
return datasets.DatasetInfo(
|
88 |
+
description=_DESCRIPTION,
|
89 |
+
features=datasets.Features(
|
90 |
+
{
|
91 |
+
_ARTICLE: datasets.Value("string"),
|
92 |
+
_HIGHLIGHTS: datasets.Value("string"),
|
93 |
+
_ID: datasets.Value("string"),
|
94 |
+
}
|
95 |
+
),
|
96 |
+
supervised_keys=None,
|
97 |
+
homepage="https://huggingface.co/datasets/ml6team/cnn_dailymail_nl",
|
98 |
+
citation=_CITATION,
|
99 |
+
)
|
100 |
+
|
101 |
+
def _split_generators(self, dl_manager):
|
102 |
+
train_paths = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URLS)
|
103 |
+
validation_path = dl_manager.download_and_extract(_VALIDATION_DOWNLOAD_URL)
|
104 |
+
test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL)
|
105 |
+
return [
|
106 |
+
datasets.SplitGenerator(
|
107 |
+
name=datasets.Split.TRAIN, gen_kwargs={"filepaths": train_paths}
|
108 |
+
),
|
109 |
+
datasets.SplitGenerator(
|
110 |
+
name=datasets.Split.VALIDATION,
|
111 |
+
gen_kwargs={"filepaths": [validation_path]},
|
112 |
+
),
|
113 |
+
datasets.SplitGenerator(
|
114 |
+
name=datasets.Split.TEST, gen_kwargs={"filepaths": [test_path]}
|
115 |
+
),
|
116 |
+
]
|
117 |
+
|
118 |
+
def _generate_examples(self, filepaths):
|
119 |
+
"""Generate Dutch CNN/Dailymail examples."""
|
120 |
+
for filepath in filepaths: # training data is divided over multiple shards
|
121 |
+
with open(filepath, encoding="utf-8") as csv_file:
|
122 |
+
csv_reader = csv.reader(
|
123 |
+
csv_file,
|
124 |
+
quotechar='"',
|
125 |
+
delimiter=",",
|
126 |
+
quoting=csv.QUOTE_ALL,
|
127 |
+
skipinitialspace=True,
|
128 |
+
)
|
129 |
+
next(csv_reader) # skip header
|
130 |
+
for row in csv_reader:
|
131 |
+
article_id, article, highlights = row
|
132 |
+
yield article_id, {
|
133 |
+
_ARTICLE: article,
|
134 |
+
_HIGHLIGHTS: highlights,
|
135 |
+
_ID: article_id,
|
136 |
+
}
|
dataset_infos.json
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"default": {
|
3 |
+
"description": " This dataset is the CNN/Dailymail dataset translated to Dutch.\n This is the original dataset:\n ```\n load_dataset(\"cnn_dailymail\", '3.0.0')\n ```\n And this is the HuggingFace translation pipeline: \n ```\n pipeline(\n task='translation_en_to_nl',\n model='Helsinki-NLP/opus-mt-en-nl',\n tokenizer='Helsinki-NLP/opus-mt-en-nl')\n ```\n",
|
4 |
+
"citation": "@article{DBLP:journals/corr/SeeLM17,\n author = {Abigail See and\n Peter J. Liu and\n Christopher D. Manning},\n title = {Get To The Point: Summarization with Pointer-Generator Networks},\n journal = {CoRR},\n volume = {abs/1704.04368},\n year = {2017},\n url = {http://arxiv.org/abs/1704.04368},\n archivePrefix = {arXiv},\n eprint = {1704.04368},\n timestamp = {Mon, 13 Aug 2018 16:46:08 +0200},\n biburl = {https://dblp.org/rec/bib/journals/corr/SeeLM17},\n bibsource = {dblp computer science bibliography, https://dblp.org}\n}\n\n@inproceedings{hermann2015teaching,\n title={Teaching machines to read and comprehend},\n author={Hermann, Karl Moritz and Kocisky, Tomas and Grefenstette, Edward and Espeholt, Lasse and Kay, Will and Suleyman, Mustafa and Blunsom, Phil},\n booktitle={Advances in neural information processing systems},\n pages={1693--1701},\n year={2015}\n}\n",
|
5 |
+
"homepage": "https://huggingface.co/datasets/ml6team/cnn_dailymail_nl",
|
6 |
+
"license": "",
|
7 |
+
"features": {
|
8 |
+
"article": {
|
9 |
+
"dtype": "string",
|
10 |
+
"id": null,
|
11 |
+
"_type": "Value"
|
12 |
+
},
|
13 |
+
"highlights": {
|
14 |
+
"dtype": "string",
|
15 |
+
"id": null,
|
16 |
+
"_type": "Value"
|
17 |
+
},
|
18 |
+
"id": {
|
19 |
+
"dtype": "string",
|
20 |
+
"id": null,
|
21 |
+
"_type": "Value"
|
22 |
+
}
|
23 |
+
},
|
24 |
+
"post_processed": null,
|
25 |
+
"supervised_keys": null,
|
26 |
+
"task_templates": null,
|
27 |
+
"builder_name": "cnn_dailymail_nl",
|
28 |
+
"config_name": "default",
|
29 |
+
"version": {
|
30 |
+
"version_str": "0.0.0",
|
31 |
+
"description": null,
|
32 |
+
"major": 0,
|
33 |
+
"minor": 0,
|
34 |
+
"patch": 0
|
35 |
+
},
|
36 |
+
"splits": {
|
37 |
+
"train": {
|
38 |
+
"name": "train",
|
39 |
+
"num_bytes": 1354614404,
|
40 |
+
"num_examples": 287113,
|
41 |
+
"dataset_name": "cnn_dailymail_nl"
|
42 |
+
},
|
43 |
+
"validation": {
|
44 |
+
"name": "validation",
|
45 |
+
"num_bytes": 61857303,
|
46 |
+
"num_examples": 13368,
|
47 |
+
"dataset_name": "cnn_dailymail_nl"
|
48 |
+
},
|
49 |
+
"test": {
|
50 |
+
"name": "test",
|
51 |
+
"num_bytes": 53509170,
|
52 |
+
"num_examples": 11490,
|
53 |
+
"dataset_name": "cnn_dailymail_nl"
|
54 |
+
}
|
55 |
+
},
|
56 |
+
"download_checksums": {
|
57 |
+
"https://huggingface.co/datasets/ml6team/cnn_dailymail_nl/resolve/main/cnn_dailymail_nl_train_000000000000.csv.gz": {
|
58 |
+
"num_bytes": 169090535,
|
59 |
+
"checksum": "96f60dd1d201f0c993114da364286fe36cf9ae49ad52ca856d25b0de7186389c"
|
60 |
+
},
|
61 |
+
"https://huggingface.co/datasets/ml6team/cnn_dailymail_nl/resolve/main/cnn_dailymail_nl_train_000000000001.csv.gz": {
|
62 |
+
"num_bytes": 169931930,
|
63 |
+
"checksum": "37e4080fa85c445cf42e263492d3070c60584711a311d90fbc5411ad8f700c8d"
|
64 |
+
},
|
65 |
+
"https://huggingface.co/datasets/ml6team/cnn_dailymail_nl/resolve/main/cnn_dailymail_nl_train_000000000002.csv.gz": {
|
66 |
+
"num_bytes": 168246772,
|
67 |
+
"checksum": "04423cfa8f773738c0f19d6fa696ab82df5138bdb77c73fcb48fa8528cca7d55"
|
68 |
+
},
|
69 |
+
"https://huggingface.co/datasets/ml6team/cnn_dailymail_nl/resolve/main/cnn_dailymail_nl_validation.csv.gz": {
|
70 |
+
"num_bytes": 22598465,
|
71 |
+
"checksum": "46bbe9a744a6a7c7e3bb47558f475b4a11db9aa25392ea9f023e3918653dbda5"
|
72 |
+
},
|
73 |
+
"https://huggingface.co/datasets/ml6team/cnn_dailymail_nl/resolve/main/cnn_dailymail_nl_test.csv.gz": {
|
74 |
+
"num_bytes": 19612656,
|
75 |
+
"checksum": "e092959ed03526b568a8281b8ca9109a451df40a1bf29c92aa27b20ec7ad0dff"
|
76 |
+
}
|
77 |
+
},
|
78 |
+
"download_size": 549480358,
|
79 |
+
"post_processing_size": null,
|
80 |
+
"dataset_size": 1469980877,
|
81 |
+
"size_in_bytes": 2019461235
|
82 |
+
}
|
83 |
+
}
|
dummy/0.0.0/dummy_data.zip
ADDED
Binary file (35.9 kB). View file
|
|