Add data and first script
Browse files- README.md +191 -0
- default/test.json.gz +3 -0
- default/train.json.gz +3 -0
- default/validation.json.gz +3 -0
- test_xsum_dutch.py +27 -0
- xsum_dutch.py +110 -0
README.md
ADDED
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
pretty_name: Extreme Summarization (XSum) in Dutch
|
3 |
+
language:
|
4 |
+
- nl
|
5 |
+
paperswithcode_id: xsum_dutch
|
6 |
+
task_categories:
|
7 |
+
- summarization
|
8 |
+
task_ids:
|
9 |
+
- news-articles-summarization
|
10 |
+
train-eval-index:
|
11 |
+
- config: default
|
12 |
+
task: summarization
|
13 |
+
task_id: summarization
|
14 |
+
splits:
|
15 |
+
train_split: train
|
16 |
+
eval_split: test
|
17 |
+
col_mapping:
|
18 |
+
document: text
|
19 |
+
summary: target
|
20 |
+
metrics:
|
21 |
+
- type: rouge
|
22 |
+
name: Rouge
|
23 |
+
---
|
24 |
+
|
25 |
+
# Dataset Card for "xsum_dutch" 🇳🇱🇧🇪 Dataset
|
26 |
+
|
27 |
+
## Table of Contents
|
28 |
+
- [Dataset Description](#dataset-description)
|
29 |
+
- [Dataset Summary](#dataset-summary)
|
30 |
+
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
31 |
+
- [Languages](#languages)
|
32 |
+
- [Dataset Structure](#dataset-structure)
|
33 |
+
- [Data Instances](#data-instances)
|
34 |
+
- [Data Fields](#data-fields)
|
35 |
+
- [Data Splits](#data-splits)
|
36 |
+
- [Dataset Creation](#dataset-creation)
|
37 |
+
- [Curation Rationale](#curation-rationale)
|
38 |
+
- [Source Data](#source-data)
|
39 |
+
- [Annotations](#annotations)
|
40 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
41 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
42 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
43 |
+
- [Discussion of Biases](#discussion-of-biases)
|
44 |
+
- [Other Known Limitations](#other-known-limitations)
|
45 |
+
- [Additional Information](#additional-information)
|
46 |
+
- [Dataset Curators](#dataset-curators)
|
47 |
+
- [Licensing Information](#licensing-information)
|
48 |
+
- [Citation Information](#citation-information)
|
49 |
+
- [Contributions](#contributions)
|
50 |
+
|
51 |
+
## Dataset Description
|
52 |
+
|
53 |
+
The Xsum Dutch 🇳🇱🇧🇪 Dataset is an English-language dataset translated to Dutch.
|
54 |
+
|
55 |
+
*This dataset currently (Aug '22) has a single config, which is
|
56 |
+
config `default` of [xsum](https://huggingface.co/datasets/xsum) translated to Dutch
|
57 |
+
with [yhavinga/t5-base-36L-ccmatrix-multi](https://huggingface.co/yhavinga/t5-base-36L-ccmatrix-multi).*
|
58 |
+
|
59 |
+
- **Homepage:** [https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset)
|
60 |
+
- **Repository:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
61 |
+
- **Paper:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
62 |
+
- **Point of Contact:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
63 |
+
- **Size of downloaded dataset files:** 245.38 MB
|
64 |
+
- **Size of the generated dataset:** 507.60 MB
|
65 |
+
- **Total amount of disk used:** 752.98 MB
|
66 |
+
|
67 |
+
### Dataset Summary
|
68 |
+
|
69 |
+
Extreme Summarization (XSum) Dataset.
|
70 |
+
|
71 |
+
There are three features:
|
72 |
+
- document: Input news article.
|
73 |
+
- summary: One sentence summary of the article.
|
74 |
+
- id: BBC ID of the article.
|
75 |
+
|
76 |
+
### Supported Tasks and Leaderboards
|
77 |
+
|
78 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
79 |
+
|
80 |
+
### Languages
|
81 |
+
|
82 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
83 |
+
|
84 |
+
## Dataset Structure
|
85 |
+
|
86 |
+
### Data Instances
|
87 |
+
|
88 |
+
#### default
|
89 |
+
|
90 |
+
- **Size of downloaded dataset files:** 245.38 MB
|
91 |
+
- **Size of the generated dataset:** 507.60 MB
|
92 |
+
- **Total amount of disk used:** 752.98 MB
|
93 |
+
|
94 |
+
An example of 'validation' looks as follows.
|
95 |
+
```
|
96 |
+
{
|
97 |
+
"document": "some-body",
|
98 |
+
"id": "29750031",
|
99 |
+
"summary": "some-sentence"
|
100 |
+
}
|
101 |
+
```
|
102 |
+
|
103 |
+
### Data Fields
|
104 |
+
|
105 |
+
The data fields are the same among all splits.
|
106 |
+
|
107 |
+
#### default
|
108 |
+
- `document`: a `string` feature.
|
109 |
+
- `summary`: a `string` feature.
|
110 |
+
- `id`: a `string` feature.
|
111 |
+
|
112 |
+
### Data Splits
|
113 |
+
|
114 |
+
| name |train |validation|test |
|
115 |
+
|-------|-----:|---------:|----:|
|
116 |
+
|default|204045| 11332|11334|
|
117 |
+
|
118 |
+
## Dataset Creation
|
119 |
+
|
120 |
+
### Curation Rationale
|
121 |
+
|
122 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
123 |
+
|
124 |
+
### Source Data
|
125 |
+
|
126 |
+
#### Initial Data Collection and Normalization
|
127 |
+
|
128 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
129 |
+
|
130 |
+
#### Who are the source language producers?
|
131 |
+
|
132 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
133 |
+
|
134 |
+
### Annotations
|
135 |
+
|
136 |
+
#### Annotation process
|
137 |
+
|
138 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
139 |
+
|
140 |
+
#### Who are the annotators?
|
141 |
+
|
142 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
143 |
+
|
144 |
+
### Personal and Sensitive Information
|
145 |
+
|
146 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
147 |
+
|
148 |
+
## Considerations for Using the Data
|
149 |
+
|
150 |
+
### Social Impact of Dataset
|
151 |
+
|
152 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
153 |
+
|
154 |
+
### Discussion of Biases
|
155 |
+
|
156 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
157 |
+
|
158 |
+
### Other Known Limitations
|
159 |
+
|
160 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
161 |
+
|
162 |
+
## Additional Information
|
163 |
+
|
164 |
+
### Dataset Curators
|
165 |
+
|
166 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
167 |
+
|
168 |
+
### Licensing Information
|
169 |
+
|
170 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
171 |
+
|
172 |
+
### Citation Information
|
173 |
+
|
174 |
+
```
|
175 |
+
|
176 |
+
@article{Narayan2018DontGM,
|
177 |
+
title={Don't Give Me the Details, Just the Summary! Topic-Aware Convolutional Neural Networks for Extreme Summarization},
|
178 |
+
author={Shashi Narayan and Shay B. Cohen and Mirella Lapata},
|
179 |
+
journal={ArXiv},
|
180 |
+
year={2018},
|
181 |
+
volume={abs/1808.08745}
|
182 |
+
}
|
183 |
+
|
184 |
+
```
|
185 |
+
|
186 |
+
|
187 |
+
### Contributions
|
188 |
+
|
189 |
+
Thanks to [@thomwolf](https://github.com/thomwolf), [@lewtun](https://github.com/lewtun), [@mariamabarham](https://github.com/mariamabarham), [@jbragg](https://github.com/jbragg), [@lhoestq](https://github.com/lhoestq), [@patrickvonplaten](https://github.com/patrickvonplaten) for adding the English version of this dataset.
|
190 |
+
The dataset was translated on Cloud TPU compute generously provided by Google through the
|
191 |
+
[TPU Research Cloud](https://sites.research.google/trc/).
|
default/test.json.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4cf0edbdcc6bc86e40ac2857b9ee78ea7a97e7c1ec9c0738c97ca6ef8841002f
|
3 |
+
size 11275971
|
default/train.json.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d45b4d3a136c85139765baeb7bd01b4daec03c877c207b627faa0d458a3a6634
|
3 |
+
size 201850351
|
default/validation.json.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b312dee491dc58e10976b8b969ea70442e835e92f9724a37290f33e208a47a88
|
3 |
+
size 11080702
|
test_xsum_dutch.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from itertools import chain
|
2 |
+
|
3 |
+
import pytest
|
4 |
+
from datasets import load_dataset
|
5 |
+
|
6 |
+
|
7 |
+
def test_streaming_dataset():
|
8 |
+
datasets = load_dataset("./cnn_dailymail_dutch.py", streaming=True)
|
9 |
+
assert set(datasets.keys()) == {"train", "validation", "test"}
|
10 |
+
|
11 |
+
for split in ["train", "validation", "test"]:
|
12 |
+
ds = datasets[split]
|
13 |
+
for i, e in enumerate(ds):
|
14 |
+
assert 10 <= len(e["article"]) <= 11000
|
15 |
+
assert 10 <= len(e["highlights"]) <= 500
|
16 |
+
if i == 100:
|
17 |
+
break
|
18 |
+
|
19 |
+
|
20 |
+
def test_train_split():
|
21 |
+
ds = load_dataset("./cnn_dailymail_dutch.py", split="train" + f"[:{2000}]")
|
22 |
+
assert len(ds) == 2000
|
23 |
+
|
24 |
+
|
25 |
+
def test_batch_dataset():
|
26 |
+
datasets = load_dataset("./cnn_dailymail_dutch.py")
|
27 |
+
assert set(datasets.keys()) == {"train", "validation", "test"}
|
xsum_dutch.py
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
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 |
+
"""Cleaned Dutch split of the mC4 corpus."""
|
16 |
+
|
17 |
+
|
18 |
+
import json
|
19 |
+
import datasets
|
20 |
+
|
21 |
+
logger = datasets.logging.get_logger(__name__)
|
22 |
+
|
23 |
+
_HOMEPAGE = "https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset"
|
24 |
+
|
25 |
+
_CITATION = """
|
26 |
+
@article{Narayan2018DontGM,
|
27 |
+
title={Don't Give Me the Details, Just the Summary! Topic-Aware Convolutional Neural Networks for Extreme Summarization},
|
28 |
+
author={Shashi Narayan and Shay B. Cohen and Mirella Lapata},
|
29 |
+
journal={ArXiv},
|
30 |
+
year={2018},
|
31 |
+
volume={abs/1808.08745}
|
32 |
+
}
|
33 |
+
"""
|
34 |
+
|
35 |
+
_DESCRIPTION = """
|
36 |
+
Extreme Summarization (XSum) Dataset.
|
37 |
+
There are three features:
|
38 |
+
- document: Input news article.
|
39 |
+
- summary: One sentence summary of the article.
|
40 |
+
- id: BBC ID of the article.
|
41 |
+
|
42 |
+
"""
|
43 |
+
|
44 |
+
|
45 |
+
_DATA_URL_NL = "https://huggingface.co/datasets/yhavinga/xsum_dutch/resolve/main/{config}/{split}.json.gz"
|
46 |
+
|
47 |
+
|
48 |
+
_DOCUMENT = "document"
|
49 |
+
_SUMMARY = "summary"
|
50 |
+
_ID = "id"
|
51 |
+
|
52 |
+
_SUPPORTED_VERSIONS = [
|
53 |
+
datasets.Version("default", "Default version."),
|
54 |
+
]
|
55 |
+
|
56 |
+
|
57 |
+
class XsumDutchConfig(datasets.BuilderConfig):
|
58 |
+
def __init__(self, **kwargs):
|
59 |
+
super().__init__(**kwargs)
|
60 |
+
|
61 |
+
|
62 |
+
class XsumDutch(datasets.GeneratorBasedBuilder):
|
63 |
+
BUILDER_CONFIGS = [
|
64 |
+
XsumDutchConfig(
|
65 |
+
name=str(version), description=version.description
|
66 |
+
)
|
67 |
+
for version in _SUPPORTED_VERSIONS
|
68 |
+
]
|
69 |
+
|
70 |
+
def _info(self):
|
71 |
+
return datasets.DatasetInfo(
|
72 |
+
description=_DESCRIPTION,
|
73 |
+
features=datasets.Features(
|
74 |
+
{
|
75 |
+
_DOCUMENT: datasets.Value("string"),
|
76 |
+
_SUMMARY: datasets.Value("string"),
|
77 |
+
"id": datasets.Value("string"),
|
78 |
+
}
|
79 |
+
),
|
80 |
+
supervised_keys=None,
|
81 |
+
homepage=_HOMEPAGE,
|
82 |
+
citation=_CITATION,
|
83 |
+
)
|
84 |
+
|
85 |
+
def _split_generators(self, dl_manager):
|
86 |
+
result = [
|
87 |
+
datasets.SplitGenerator(
|
88 |
+
name=split,
|
89 |
+
gen_kwargs={
|
90 |
+
"filepath": dl_manager.download_and_extract(
|
91 |
+
_DATA_URL_NL.format(split=str(split), config=str(self.config.name))
|
92 |
+
)
|
93 |
+
},
|
94 |
+
)
|
95 |
+
for split in [
|
96 |
+
datasets.Split.TRAIN,
|
97 |
+
datasets.Split.VALIDATION,
|
98 |
+
datasets.Split.TEST,
|
99 |
+
]
|
100 |
+
]
|
101 |
+
return result
|
102 |
+
|
103 |
+
def _generate_examples(self, filepath):
|
104 |
+
"""This function returns the examples in the raw (text) form by iterating on all the files."""
|
105 |
+
logger.info(f"Generating examples from {filepath}")
|
106 |
+
|
107 |
+
with open(filepath, "r") as file:
|
108 |
+
for _id, line in enumerate(file):
|
109 |
+
example = json.loads(line)
|
110 |
+
yield _id, example
|