Datasets:
Tasks:
Summarization
Sub-tasks:
news-articles-summarization
Languages:
Dutch
Size:
100K<n<1M
License:
File size: 4,622 Bytes
48973a6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Cleaned Dutch split of the mC4 corpus."""
import json
import datasets
logger = datasets.logging.get_logger(__name__)
_HOMEPAGE = "https://github.com/abisee/cnn-dailymail"
_DESCRIPTION = """\
CNN/DailyMail non-anonymized summarization dataset, translated to Dutch with ccmatrix.
There are two features:
- article: text of news article, used as the document to be summarized
- highlights: joined text of highlights with <s> and </s> around each
highlight, which is the target summary
"""
_LICENSE = "Open Data Commons Attribution License (ODC-By) v1.0"
_DATA_URL_NL = "https://huggingface.co/datasets/yhavinga/cnn_dailymail_dutch/resolve/main/{config}/{split}.json.gz"
# The second citation introduces the source data, while the first
# introduces the specific form (non-anonymized) we use here.
_CITATION = """\
@article{DBLP:journals/corr/SeeLM17,
author = {Abigail See and
Peter J. Liu and
Christopher D. Manning},
title = {Get To The Point: Summarization with Pointer-Generator Networks},
journal = {CoRR},
volume = {abs/1704.04368},
year = {2017},
url = {http://arxiv.org/abs/1704.04368},
archivePrefix = {arXiv},
eprint = {1704.04368},
timestamp = {Mon, 13 Aug 2018 16:46:08 +0200},
biburl = {https://dblp.org/rec/bib/journals/corr/SeeLM17},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
@inproceedings{hermann2015teaching,
title={Teaching machines to read and comprehend},
author={Hermann, Karl Moritz and Kocisky, Tomas and Grefenstette, Edward and Espeholt, Lasse and Kay, Will and Suleyman, Mustafa and Blunsom, Phil},
booktitle={Advances in neural information processing systems},
pages={1693--1701},
year={2015}
}
"""
_HIGHLIGHTS = "highlights"
_ARTICLE = "article"
_SUPPORTED_VERSIONS = [
# Using cased version.
datasets.Version("3.0.0", "Using cased version."),
]
class CnnDailymailDutchConfig(datasets.BuilderConfig):
"""BuilderConfig for CnnDailymail Dutch."""
def __init__(self, **kwargs):
"""BuilderConfig for CnnDailymail Dutch.
Args:
**kwargs: keyword arguments forwarded to super.
"""
super().__init__(**kwargs)
class CnnDailymailDutch(datasets.GeneratorBasedBuilder):
"""CNN/DailyMail non-anonymized summarization dataset in Dutch."""
BUILDER_CONFIGS = [
CnnDailymailDutchConfig(
name=str(version), description=version.description
)
for version in _SUPPORTED_VERSIONS
]
def _info(self):
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=datasets.Features(
{
_ARTICLE: datasets.Value("string"),
_HIGHLIGHTS: datasets.Value("string"),
"id": datasets.Value("string"),
}
),
supervised_keys=None,
homepage=_HOMEPAGE,
license=_LICENSE,
citation=_CITATION,
)
def _split_generators(self, dl_manager):
result = [
datasets.SplitGenerator(
name=split,
gen_kwargs={
"filepath": dl_manager.download_and_extract(
_DATA_URL_NL.format(split=str(split), config=str(self.config.name))
)
},
)
for split in [
datasets.Split.TRAIN,
datasets.Split.VALIDATION,
datasets.Split.TEST,
]
]
return result
def _generate_examples(self, filepath):
"""This function returns the examples in the raw (text) form by iterating on all the files."""
logger.info(f"Generating examples from {filepath}")
with open(filepath, "r") as file:
for _id, line in enumerate(file):
example = json.loads(line)
yield _id, example
|