Datasets:
GEM
/

Tasks:
Other
Languages:
English
Multilinguality:
unknown
Size Categories:
unknown
Language Creators:
unknown
Annotations Creators:
none
Source Datasets:
original
License:
File size: 7,024 Bytes
6078f55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1b06c77
6078f55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1b06c77
6078f55
1b06c77
 
 
 
 
6078f55
 
 
 
 
 
 
 
 
 
 
d713b85
6078f55
 
 
d713b85
6078f55
 
 
 
 
 
 
f60021e
 
6078f55
 
 
 
 
 
 
1b06c77
6078f55
1b06c77
 
 
 
 
 
 
 
6078f55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b55bb32
 
 
 
 
 
 
 
 
efdd8a8
6078f55
b55bb32
 
6078f55
08e93fd
f60021e
08e93fd
 
 
 
 
 
 
 
f60021e
 
6078f55
 
 
 
 
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import json
import os

import datasets

_CITATION = """\
@inproceedings{sun-etal-2021-d2s,
    title = "{D}2{S}: Document-to-Slide Generation Via Query-Based Text Summarization",
    author = "Sun, Edward  and
      Hou, Yufang  and
      Wang, Dakuo  and
      Zhang, Yunfeng  and
      Wang, Nancy X. R.",
    booktitle = "Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies",
    month = June,
    year = "2021",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2021.naacl-main.111",
    doi = "10.18653/v1/2021.naacl-main.111",
    pages = "1405--1418",
}
"""

_DESCRIPTION = """\
SciDuet is the first publicaly available dataset for the challenging task of document2slides generation,
The dataset integrated into GEM is the ACL portion of the whole dataset described in "https://aclanthology.org/2021.naacl-main.111.pdf".
It contains the full Dev and Test sets, and a portion of the Train dataset. 
We additionally create a challenge dataset in which the slide titles do not match with the 
section headers of the corresponding paper.
Note that although we cannot release the whole training dataset due to copyright issues, researchers can still 
use our released data procurement code from https://github.com/IBM/document2slides
to generate the training dataset from the online ICML/NeurIPS anthologies. 
In the released dataset, the original papers and slides (both are in PDF format) are carefully processed by a combination of PDF/Image processing tookits.
The text contents from multiple slides that correspond to the same slide title are mreged. 
"""




class SciDuetConfig(datasets.BuilderConfig):
    """BuilderConfig for SciDuet."""

    def __init__(self, **kwargs):
        """BuilderConfig for SciDuet.
        Args:
          **kwargs: keyword arguments forwarded to super.
        """
        super(SciDuetConfig, self).__init__(**kwargs)


class SciDuet(datasets.GeneratorBasedBuilder):

    VERSION = datasets.Version("1.0.0")

    # BUILDER_CONFIGS = [
    #     SciDuetConfig(name="gem_data_split", version=VERSION_1, description="SciDuet - GEM version 1"),
    # ]
    #
    # DEFAULT_CONFIG_NAME = "gem_data_split"

    def _info(self):

        return datasets.DatasetInfo(
            description=_DESCRIPTION,
            features=datasets.Features(
                {
                    "gem_id": datasets.Value("string"),
                    "paper_id": datasets.Value("string"),
                    "paper_title": datasets.Value("string"),
                    "paper_abstract": datasets.Value("string"),
                    "paper_content": datasets.features.Sequence({
                            "paper_content_id": datasets.Value("int32"),
                            "paper_content_text": datasets.Value("string"),
                        }),
                    "paper_headers": datasets.features.Sequence({
                            "paper_header_number": datasets.Value("string"),
                            "paper_header_content": datasets.Value("string"),
                        }),

                    "slide_id": datasets.Value("string"),
                    "slide_title": datasets.Value("string"),
                    "slide_content_text": datasets.Value("string"),
                    "target": datasets.Value("string"),
                    "references": [datasets.Value("string")],
                }
            ),
            supervised_keys=None,
            license="Apache License 2.0",
            citation=_CITATION,
        )


    def _split_generators(self, dl_manager):
        _URL = "https://huggingface.co/datasets/GEM/SciDuet/"
        _URLs = {
            "train": "train.json",
            "validation": "validation.json",
            "test": "test.json",
            "challenge_set": "challenge_woSectionHeader.json",
        }
        downloaded_files = dl_manager.download_and_extract(_URLs)

        return [
                datasets.SplitGenerator(
                    name=datasets.Split.TRAIN,
                    gen_kwargs={
                        "filepath": downloaded_files["train"],
                        "split": "train",
                        },
                    ),
                datasets.SplitGenerator(
                    name=datasets.Split.VALIDATION,
                    gen_kwargs={
                        "filepath": downloaded_files["validation"],
                        "split": "validation",
                        },
                    ),
                datasets.SplitGenerator(
                    name=datasets.Split.TEST,
                    gen_kwargs={
                        "filepath": downloaded_files["test"],
                        "split": "test",
                        },
                    ),
            ] + [
            datasets.SplitGenerator(
                name="challenge_woSectionHeader",
                gen_kwargs={
                    "filepath": downloaded_files["challenge_set"],
                    "split": "challenge_woSectionHeader",
                },
            ),
        ]

    def _generate_examples(self, filepath, split):
        """Yields examples."""
        with open(filepath, encoding="utf-8") as f:
            data = json.load(f)["data"]
            for item in data:
                gem_id = item["gem_id"]
                paper_id = item["paper_id"]
                paper_title = item["paper_title"]
                paper_abstract = item["paper"]["abstract"]
                paper_content_ids = [text["id"] for text in item["paper"]["text"]]
                paper_content_texts = [text["string"] for text in item["paper"]["text"]]
                paper_header_numbers = [header["n"] for header in item["paper"]["headers"]]
                paper_header_contents = [header["section"] for header in item["paper"]["headers"]]
                for j in item["slides"]:
                    id_ = gem_id + "#" + "paper-" + paper_id + "#" + "slide-" + str(j)
                    slide_title = item["slides"][j]["title"]
                    slide_content_text = '\n'.join(item["slides"][j]["text"])

                    yield id_, {
                        "gem_id": id_,
                        "paper_id": paper_id,
                        "paper_title": paper_title,
                        "paper_abstract": paper_abstract,
                        "paper_content": {"paper_content_id":paper_content_ids, "paper_content_text":paper_content_texts},
                        "paper_headers": {"paper_header_number":paper_header_numbers, "paper_header_content":paper_header_contents},
                        "slide_id": id_,
                        "slide_title": slide_title,
                        "slide_content_text": slide_content_text,
                        "target": slide_content_text,
                        "references": [] if split == "train" else [slide_content_text],
                }