Datasets:

Modalities:
Text
Formats:
parquet
Languages:
English
ArXiv:
License:

Convert dataset to Parquet

#9
by lhoestq HF Staff - opened
README.md CHANGED
@@ -19,19 +19,6 @@ task_categories:
19
  - summarization
20
  task_ids:
21
  - news-articles-summarization
22
- train-eval-index:
23
- - config: default
24
- task: summarization
25
- task_id: summarization
26
- splits:
27
- train_split: train
28
- eval_split: test
29
- col_mapping:
30
- document: text
31
- summary: target
32
- metrics:
33
- - type: rouge
34
- name: Rouge
35
  dataset_info:
36
  features:
37
  - name: document
@@ -42,16 +29,38 @@ dataset_info:
42
  dtype: string
43
  splits:
44
  - name: train
45
- num_bytes: 479206608
46
  num_examples: 204045
47
  - name: validation
48
- num_bytes: 26292901
49
  num_examples: 11332
50
  - name: test
51
- num_bytes: 26756165
52
  num_examples: 11334
53
- download_size: 257302866
54
- dataset_size: 532255674
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  ---
56
 
57
  # Dataset Card for "xsum"
 
19
  - summarization
20
  task_ids:
21
  - news-articles-summarization
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  dataset_info:
23
  features:
24
  - name: document
 
29
  dtype: string
30
  splits:
31
  - name: train
32
+ num_bytes: 479206363
33
  num_examples: 204045
34
  - name: validation
35
+ num_bytes: 26292877
36
  num_examples: 11332
37
  - name: test
38
+ num_bytes: 26756141
39
  num_examples: 11334
40
+ download_size: 332791351
41
+ dataset_size: 532255381
42
+ configs:
43
+ - config_name: default
44
+ data_files:
45
+ - split: train
46
+ path: data/train-*
47
+ - split: validation
48
+ path: data/validation-*
49
+ - split: test
50
+ path: data/test-*
51
+ train-eval-index:
52
+ - config: default
53
+ task: summarization
54
+ task_id: summarization
55
+ splits:
56
+ train_split: train
57
+ eval_split: test
58
+ col_mapping:
59
+ document: text
60
+ summary: target
61
+ metrics:
62
+ - type: rouge
63
+ name: Rouge
64
  ---
65
 
66
  # Dataset Card for "xsum"
data/{XSUM-EMNLP18-Summary-Data-Original.tar.gz → test-00000-of-00001.parquet} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:10b48aa187fc9c904b30f76ca97e2da0de8d3a1238acc26acadef93e2001af90
3
- size 254582292
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:224e9dbc6fed987759c1954603b43cb280b8d475d78893779130aa707d967ed7
3
+ size 16731226
data/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0bba72d330f2a35ba20321444e54724e487b49f2eab6b26625b5f282d1c797c9
3
+ size 299612457
data/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b7fc808c2dd3d1340349481aeef489e6eb8c22ff5739d8bce6d0f99e5ef8044d
3
+ size 16447668
xsum.py DELETED
@@ -1,170 +0,0 @@
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
- """XSum dataset."""
18
-
19
-
20
- import json
21
- import os
22
-
23
- import datasets
24
-
25
-
26
- _CITATION = """
27
- @article{Narayan2018DontGM,
28
- title={Don't Give Me the Details, Just the Summary! Topic-Aware Convolutional Neural Networks for Extreme Summarization},
29
- author={Shashi Narayan and Shay B. Cohen and Mirella Lapata},
30
- journal={ArXiv},
31
- year={2018},
32
- volume={abs/1808.08745}
33
- }
34
- """
35
-
36
- _DESCRIPTION = """
37
- Extreme Summarization (XSum) Dataset.
38
-
39
- There are three features:
40
- - document: Input news article.
41
- - summary: One sentence summary of the article.
42
- - id: BBC ID of the article.
43
-
44
- """
45
-
46
- # From https://github.com/EdinburghNLP/XSum/issues/12
47
- _URL_DATA = "data/XSUM-EMNLP18-Summary-Data-Original.tar.gz"
48
- _URL_SPLITS = (
49
- "https://raw.githubusercontent.com/EdinburghNLP/XSum/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json"
50
- )
51
-
52
- _DOCUMENT = "document"
53
- _SUMMARY = "summary"
54
- _ID = "id"
55
-
56
- _REMOVE_LINES = set(
57
- [
58
- "Share this with\n",
59
- "Email\n",
60
- "Facebook\n",
61
- "Messenger\n",
62
- "Twitter\n",
63
- "Pinterest\n",
64
- "WhatsApp\n",
65
- "Linkedin\n",
66
- "LinkedIn\n",
67
- "Copy this link\n",
68
- "These are external links and will open in a new window\n",
69
- ]
70
- )
71
-
72
-
73
- class Xsum(datasets.GeneratorBasedBuilder):
74
- """Extreme Summarization (XSum) Dataset."""
75
-
76
- # Version 1.2.0 expands coverage, includes ids, and removes web contents.
77
- VERSION = datasets.Version("1.2.0")
78
-
79
- def _info(self):
80
- return datasets.DatasetInfo(
81
- description=_DESCRIPTION,
82
- features=datasets.Features(
83
- {
84
- _DOCUMENT: datasets.Value("string"),
85
- _SUMMARY: datasets.Value("string"),
86
- _ID: datasets.Value("string"),
87
- }
88
- ),
89
- supervised_keys=(_DOCUMENT, _SUMMARY),
90
- homepage="https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset",
91
- citation=_CITATION,
92
- )
93
-
94
- def _split_generators(self, dl_manager):
95
- """Returns SplitGenerators."""
96
-
97
- files_to_download = {"data": _URL_DATA, "splits": _URL_SPLITS}
98
- downloaded_files = dl_manager.download(files_to_download)
99
-
100
- return [
101
- datasets.SplitGenerator(
102
- name=datasets.Split.TRAIN,
103
- gen_kwargs={
104
- "split_path": downloaded_files["splits"],
105
- "split_name": "train",
106
- "data_dir": "bbc-summary-data",
107
- "files": dl_manager.iter_archive(downloaded_files["data"]),
108
- },
109
- ),
110
- datasets.SplitGenerator(
111
- name=datasets.Split.VALIDATION,
112
- gen_kwargs={
113
- "split_path": downloaded_files["splits"],
114
- "split_name": "validation",
115
- "data_dir": "bbc-summary-data",
116
- "files": dl_manager.iter_archive(downloaded_files["data"]),
117
- },
118
- ),
119
- datasets.SplitGenerator(
120
- name=datasets.Split.TEST,
121
- gen_kwargs={
122
- "split_path": downloaded_files["splits"],
123
- "split_name": "test",
124
- "data_dir": "bbc-summary-data",
125
- "files": dl_manager.iter_archive(downloaded_files["data"]),
126
- },
127
- ),
128
- ]
129
-
130
- def _generate_examples(self, split_path, split_name, data_dir, files):
131
- """Yields examples."""
132
-
133
- with open(split_path, "r", encoding="utf-8") as f:
134
- split_ids = json.load(f)
135
- split_ids = {k: set(v) for k, v in split_ids.items()}
136
-
137
- for path, f in files:
138
- if not split_ids[split_name]:
139
- break
140
- elif path.startswith(data_dir) and path.endswith(".summary"):
141
- i = os.path.basename(path).split(".")[0]
142
- if i in split_ids[split_name]:
143
- split_ids[split_name].remove(i)
144
- text = "".join(
145
- [
146
- line.decode("utf-8")
147
- for line in f.readlines()
148
- if line.decode("utf-8") not in _REMOVE_LINES and line.strip()
149
- ]
150
- )
151
- # Each file follows below format:
152
- # [SN]URL[SN]
153
- # http://somelink
154
- #
155
- # [SN]TITLE[SN]
156
- # some intro
157
- #
158
- # [SN]FIRST-SENTENCE[SN]
159
- # some intro
160
- #
161
- # [SN]RESTBODY[SN]
162
- # text line.
163
- # another text line.
164
- # "another text line."
165
-
166
- # According to the following issue, FIRST-SENTENCE
167
- # is the reference summary and TITLE is unused:
168
- # https://github.com/EdinburghNLP/XSum/issues/22
169
- segs = text.split("[SN]")
170
- yield i, {_DOCUMENT: segs[8].strip(), _SUMMARY: segs[6].strip(), _ID: i}