system HF staff commited on
Commit
5fa1ba0
0 Parent(s):

Update files from the datasets library (from 1.2.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.2.0

Files changed (5) hide show
  1. .gitattributes +27 -0
  2. README.md +186 -0
  3. dataset_infos.json +1 -0
  4. dummy/0.0.0/dummy_data.zip +3 -0
  5. sent_comp.py +155 -0
.gitattributes ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.onnx filter=lfs diff=lfs merge=lfs -text
14
+ *.ot filter=lfs diff=lfs merge=lfs -text
15
+ *.parquet filter=lfs diff=lfs merge=lfs -text
16
+ *.pb filter=lfs diff=lfs merge=lfs -text
17
+ *.pt filter=lfs diff=lfs merge=lfs -text
18
+ *.pth filter=lfs diff=lfs merge=lfs -text
19
+ *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
22
+ *.tflite filter=lfs diff=lfs merge=lfs -text
23
+ *.tgz filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - machine-generated
4
+ language_creators:
5
+ - found
6
+ languages:
7
+ - en
8
+ licenses:
9
+ - unknown
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 100K<n<1M
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - other
18
+ task_ids:
19
+ - other-other-sentence-compression
20
+ ---
21
+
22
+ # Dataset Card for Google Sentence Compression
23
+
24
+ ## Table of Contents
25
+
26
+ - [Dataset Card for Google Sentence Compression](#dataset-card-for-google-sentence-compression)
27
+ - [Table of Contents](#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
+ - [Initial Data Collection and Normalization](#initial-data-collection-and-normalization)
40
+ - [Who are the source language producers?](#who-are-the-source-language-producers)
41
+ - [Annotations](#annotations)
42
+ - [Annotation process](#annotation-process)
43
+ - [Who are the annotators?](#who-are-the-annotators)
44
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
45
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
46
+ - [Social Impact of Dataset](#social-impact-of-dataset)
47
+ - [Discussion of Biases](#discussion-of-biases)
48
+ - [Other Known Limitations](#other-known-limitations)
49
+ - [Additional Information](#additional-information)
50
+ - [Dataset Curators](#dataset-curators)
51
+ - [Licensing Information](#licensing-information)
52
+ - [Citation Information](#citation-information)
53
+
54
+ ## Dataset Description
55
+
56
+ - **Homepage:[https://github.com/google-research-datasets/sentence-compression](https://github.com/google-research-datasets/sentence-compression)**
57
+ - **Repository:[https://github.com/google-research-datasets/sentence-compression](https://github.com/google-research-datasets/sentence-compression)**
58
+ - **Paper:[https://www.aclweb.org/anthology/D13-1155/](https://www.aclweb.org/anthology/D13-1155/)**
59
+ - **Leaderboard:**
60
+ - **Point of Contact:**
61
+
62
+ ### Dataset Summary
63
+
64
+ A major challenge in supervised sentence compression is making use of rich feature representations because of very scarce parallel data. We address this problem and present a method to automatically build a compression corpus with hundreds of thousands of instances on which deletion-based algorithms can be trained. In our corpus, the syntactic trees of the compressions are subtrees of their uncompressed counterparts, and hence supervised systems which require a structural alignment between the input and output can be successfully trained. We also extend an existing unsupervised compression method with a learning module. The new system uses structured prediction to learn from lexical, syntactic and other features. An evaluation with human raters shows that the presented data harvesting method indeed produces a parallel corpus of high quality. Also, the supervised system trained on this corpus gets high scores both from human raters and in an automatic evaluation setting, significantly outperforming a strong baseline.
65
+
66
+ ### Supported Tasks and Leaderboards
67
+
68
+ [More Information Needed]
69
+
70
+ ### Languages
71
+
72
+ English
73
+
74
+ ## Dataset Structure
75
+
76
+ ### Data Instances
77
+
78
+ Each data instance should contains the information about the original sentence in `instance["graph"]["sentence"]` as well as the compressed sentence in `instance["compression"]["text"]`. As this dataset was created by pruning dependency connections, the author also includes the dependency tree and transformed graph of the original sentence and compressed sentence.
79
+
80
+ ### Data Fields
81
+
82
+ Each instance should contains these information:
83
+
84
+ - `graph` (`Dict`): the transformation graph/tree for extracting compression (a modified version of a dependency tree).
85
+ - This will have features similar to a dependency tree (listed bellow)
86
+ - `compression` (`Dict`)
87
+ - `text` (`str`)
88
+ - `edge` (`List`)
89
+ - `headline` (`str`): the headline of the original news page.
90
+ - `compression_ratio` (`float`): the ratio between compressed sentence vs original sentence.
91
+ - `doc_id` (`str`): url of the original news page.
92
+ - `source_tree` (`Dict`): the original dependency tree (features listed bellow).
93
+ - `compression_untransformed` (`Dict`)
94
+ - `text` (`str`)
95
+ - `edge` (`List`)
96
+
97
+ Dependency tree features:
98
+
99
+ - `id` (`str`)
100
+ - `sentence` (`str`)
101
+ - `node` (`List`): list of nodes, each node represent a word/word phrase in the tree.
102
+ - `form` (`string`)
103
+ - `type` (`string`): the enity type of a node. Defaults to `""` if it's not an entity.
104
+ - `mid` (`string`)
105
+ - `word` (`List`): list of words the node contains.
106
+ - `id` (`int`)
107
+ - `form` (`str`): the word from the sentence.
108
+ - `stem` (`str`): the stemmed/lemmatized version of the word.
109
+ - `tag` (`str`): dependency tag of the word.
110
+ - `gender` (`int`)
111
+ - `head_word_index` (`int`)
112
+ - `edge`: list of the dependency connections between words.
113
+ - `parent_id` (`int`)
114
+ - `child_id` (`int`)
115
+ - `label` (`str`)
116
+ - `entity_mention` list of the entities in the sentence.
117
+ - `start` (`int`)
118
+ - `end` (`int`)
119
+ - `head` (`str`)
120
+ - `name` (`str`)
121
+ - `type` (`str`)
122
+ - `mid` (`str`)
123
+ - `is_proper_name_entity` (`bool`)
124
+ - `gender` (`int`)
125
+
126
+ ### Data Splits
127
+
128
+ [More Information Needed]
129
+
130
+ ## Dataset Creation
131
+
132
+ ### Curation Rationale
133
+
134
+ [More Information Needed]
135
+
136
+ ### Source Data
137
+
138
+ #### Initial Data Collection and Normalization
139
+
140
+ [More Information Needed]
141
+
142
+ #### Who are the source language producers?
143
+
144
+ [More Information Needed]
145
+
146
+ ### Annotations
147
+
148
+ #### Annotation process
149
+
150
+ [More Information Needed]
151
+
152
+ #### Who are the annotators?
153
+
154
+ [More Information Needed]
155
+
156
+ ### Personal and Sensitive Information
157
+
158
+ [More Information Needed]
159
+
160
+ ## Considerations for Using the Data
161
+
162
+ ### Social Impact of Dataset
163
+
164
+ [More Information Needed]
165
+
166
+ ### Discussion of Biases
167
+
168
+ [More Information Needed]
169
+
170
+ ### Other Known Limitations
171
+
172
+ [More Information Needed]
173
+
174
+ ## Additional Information
175
+
176
+ ### Dataset Curators
177
+
178
+ [More Information Needed]
179
+
180
+ ### Licensing Information
181
+
182
+ [More Information Needed]
183
+
184
+ ### Citation Information
185
+
186
+ [More Information Needed]
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"default": {"description": "Large corpus of uncompressed and compressed sentences from news articles.\n", "citation": "@inproceedings{filippova-altun-2013-overcoming,\n title = \"Overcoming the Lack of Parallel Data in Sentence Compression\",\n author = \"Filippova, Katja and\n Altun, Yasemin\",\n booktitle = \"Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing\",\n month = oct,\n year = \"2013\",\n address = \"Seattle, Washington, USA\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/D13-1155\",\n pages = \"1481--1491\",\n}\n", "homepage": "https://github.com/google-research-datasets/sentence-compression", "license": "", "features": {"graph": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "sentence": {"dtype": "string", "id": null, "_type": "Value"}, "node": {"feature": {"form": {"dtype": "string", "id": null, "_type": "Value"}, "type": {"dtype": "string", "id": null, "_type": "Value"}, "mid": {"dtype": "string", "id": null, "_type": "Value"}, "word": {"feature": {"id": {"dtype": "int32", "id": null, "_type": "Value"}, "form": {"dtype": "string", "id": null, "_type": "Value"}, "stem": {"dtype": "string", "id": null, "_type": "Value"}, "tag": {"dtype": "string", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "gender": {"dtype": "int32", "id": null, "_type": "Value"}, "head_word_index": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "edge": {"feature": {"parent_id": {"dtype": "int32", "id": null, "_type": "Value"}, "child_id": {"dtype": "int32", "id": null, "_type": "Value"}, "label": {"dtype": "string", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "entity_mention": {"feature": {"start": {"dtype": "int32", "id": null, "_type": "Value"}, "end": {"dtype": "int32", "id": null, "_type": "Value"}, "head": {"dtype": "int32", "id": null, "_type": "Value"}, "name": {"dtype": "string", "id": null, "_type": "Value"}, "type": {"dtype": "string", "id": null, "_type": "Value"}, "mid": {"dtype": "string", "id": null, "_type": "Value"}, "is_proper_name_entity": {"dtype": "bool", "id": null, "_type": "Value"}, "gender": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "compression": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "edge": {"feature": {"parent_id": {"dtype": "int32", "id": null, "_type": "Value"}, "child_id": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "headline": {"dtype": "string", "id": null, "_type": "Value"}, "compression_ratio": {"dtype": "float32", "id": null, "_type": "Value"}, "doc_id": {"dtype": "string", "id": null, "_type": "Value"}, "source_tree": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "sentence": {"dtype": "string", "id": null, "_type": "Value"}, "node": {"feature": {"form": {"dtype": "string", "id": null, "_type": "Value"}, "type": {"dtype": "string", "id": null, "_type": "Value"}, "mid": {"dtype": "string", "id": null, "_type": "Value"}, "word": {"feature": {"id": {"dtype": "int32", "id": null, "_type": "Value"}, "form": {"dtype": "string", "id": null, "_type": "Value"}, "stem": {"dtype": "string", "id": null, "_type": "Value"}, "tag": {"dtype": "string", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "gender": {"dtype": "int32", "id": null, "_type": "Value"}, "head_word_index": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "edge": {"feature": {"parent_id": {"dtype": "int32", "id": null, "_type": "Value"}, "child_id": {"dtype": "int32", "id": null, "_type": "Value"}, "label": {"dtype": "string", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "entity_mention": {"feature": {"start": {"dtype": "int32", "id": null, "_type": "Value"}, "end": {"dtype": "int32", "id": null, "_type": "Value"}, "head": {"dtype": "int32", "id": null, "_type": "Value"}, "name": {"dtype": "string", "id": null, "_type": "Value"}, "type": {"dtype": "string", "id": null, "_type": "Value"}, "mid": {"dtype": "string", "id": null, "_type": "Value"}, "is_proper_name_entity": {"dtype": "bool", "id": null, "_type": "Value"}, "gender": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "compression_untransformed": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "edge": {"feature": {"parent_id": {"dtype": "int32", "id": null, "_type": "Value"}, "child_id": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}}, "post_processed": null, "supervised_keys": null, "builder_name": "sent_comp", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"validation": {"name": "validation", "num_bytes": 55823979, "num_examples": 10000, "dataset_name": "sent_comp"}, "train": {"name": "train", "num_bytes": 1135684803, "num_examples": 200000, "dataset_name": "sent_comp"}}, "download_checksums": {"https://github.com/google-research-datasets/sentence-compression/raw/master/data/comp-data.eval.json.gz": {"num_bytes": 12183133, "checksum": "a8d01880fb889a95ab3918b1036b4056da760fb173bfbe9c9a68707d0a44196f"}, "https://github.com/google-research-datasets/sentence-compression/raw/master/data/sent-comp.train01.json.gz": {"num_bytes": 24661983, "checksum": "248095421694290bb92a2c28e05ffdb7e5e6bd7afcf8838b1167cea6006d5e33"}, "https://github.com/google-research-datasets/sentence-compression/raw/master/data/sent-comp.train02.json.gz": {"num_bytes": 24775828, "checksum": "2bd1785627feb5425a6c45fc2730f2be09bf38aceff6fd30bbb59f83a8f68f90"}, "https://github.com/google-research-datasets/sentence-compression/raw/master/data/sent-comp.train03.json.gz": {"num_bytes": 24726758, "checksum": "d7c673d5de5488384dda8e6bf93f304646f876bed803f757106b1dbb7d036684"}, "https://github.com/google-research-datasets/sentence-compression/raw/master/data/sent-comp.train04.json.gz": {"num_bytes": 24721492, "checksum": "7f8c47ce6a8d635f4af1f9900187fa9122baf4a0fa7294a3042b8980031c8920"}, "https://github.com/google-research-datasets/sentence-compression/raw/master/data/sent-comp.train05.json.gz": {"num_bytes": 24752435, "checksum": "35b6ab7d8643960bd274ae101d4bfabefbe60f7457a4befb2640c5ae97c690b4"}, "https://github.com/google-research-datasets/sentence-compression/raw/master/data/sent-comp.train06.json.gz": {"num_bytes": 24704732, "checksum": "109a9a081f08a36abefb1e9c52ab69236d450e6715ecba2b97d08ec7d687e54c"}, "https://github.com/google-research-datasets/sentence-compression/raw/master/data/sent-comp.train07.json.gz": {"num_bytes": 24832103, "checksum": "5e92b30b2c4689ef672d950bef57ef1af32a1d4e1a57b7024978fefd0d3f0149"}, "https://github.com/google-research-datasets/sentence-compression/raw/master/data/sent-comp.train08.json.gz": {"num_bytes": 24793936, "checksum": "052e21b8a0ae3a12fc01d7a7463762e316bacc17ebdff4406ed1f7675d16daf8"}, "https://github.com/google-research-datasets/sentence-compression/raw/master/data/sent-comp.train09.json.gz": {"num_bytes": 24749008, "checksum": "63722d8501736c50a72bb8e4449a738bff9f7103f35112879685df38c715c5ec"}, "https://github.com/google-research-datasets/sentence-compression/raw/master/data/sent-comp.train10.json.gz": {"num_bytes": 24751152, "checksum": "a13dc4fb356db0080795facc5ef8e944f4b31bdd79899b439e55a7cfea3b40ef"}}, "download_size": 259652560, "post_processing_size": null, "dataset_size": 1191508782, "size_in_bytes": 1451161342}}
dummy/0.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:783e0810f87fb1975f87dd2bcac93b4b72ab1a9c5512f85a4bc1186e0178f1b8
3
+ size 6103
sent_comp.py ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """Google Sentence Compression dataset"""
16
+
17
+ from __future__ import absolute_import, division, print_function
18
+
19
+ import gzip
20
+ import json
21
+
22
+ import datasets
23
+
24
+
25
+ _CITATION = """\
26
+ @inproceedings{filippova-altun-2013-overcoming,
27
+ title = "Overcoming the Lack of Parallel Data in Sentence Compression",
28
+ author = "Filippova, Katja and
29
+ Altun, Yasemin",
30
+ booktitle = "Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing",
31
+ month = oct,
32
+ year = "2013",
33
+ address = "Seattle, Washington, USA",
34
+ publisher = "Association for Computational Linguistics",
35
+ url = "https://www.aclweb.org/anthology/D13-1155",
36
+ pages = "1481--1491",
37
+ }
38
+ """
39
+
40
+ _DESCRIPTION = """\
41
+ Large corpus of uncompressed and compressed sentences from news articles.
42
+ """
43
+
44
+ _HOMEPAGE = "https://github.com/google-research-datasets/sentence-compression"
45
+
46
+
47
+ _URLs = {
48
+ datasets.Split.VALIDATION: [
49
+ "https://github.com/google-research-datasets/sentence-compression/raw/master/data/comp-data.eval.json.gz"
50
+ ],
51
+ datasets.Split.TRAIN: [
52
+ f"https://github.com/google-research-datasets/sentence-compression/raw/master/data/sent-comp.train{str(i).zfill(2)}.json.gz"
53
+ for i in range(1, 11)
54
+ ],
55
+ }
56
+
57
+
58
+ class SentComp(datasets.GeneratorBasedBuilder):
59
+ """Google Setence Compression dataset"""
60
+
61
+ def _info(self):
62
+ node_features = {
63
+ "form": datasets.Value("string"),
64
+ "type": datasets.Value("string"),
65
+ "mid": datasets.Value("string"),
66
+ "word": datasets.features.Sequence(
67
+ {
68
+ "id": datasets.Value("int32"),
69
+ "form": datasets.Value("string"),
70
+ "stem": datasets.Value("string"),
71
+ "tag": datasets.Value("string"),
72
+ }
73
+ ),
74
+ "gender": datasets.Value("int32"),
75
+ "head_word_index": datasets.Value("int32"),
76
+ }
77
+ compression_edge_features = {
78
+ "parent_id": datasets.Value("int32"),
79
+ "child_id": datasets.Value("int32"),
80
+ }
81
+ edge_features = {**compression_edge_features, "label": datasets.Value("string")}
82
+ entity_features = {
83
+ "start": datasets.Value("int32"),
84
+ "end": datasets.Value("int32"),
85
+ "head": datasets.Value("int32"),
86
+ "name": datasets.Value("string"),
87
+ "type": datasets.Value("string"),
88
+ "mid": datasets.Value("string"),
89
+ "is_proper_name_entity": datasets.Value("bool"),
90
+ "gender": datasets.Value("int32"),
91
+ }
92
+ tree_features = {
93
+ "id": datasets.Value("string"),
94
+ "sentence": datasets.Value("string"),
95
+ "node": datasets.features.Sequence(node_features),
96
+ "edge": datasets.features.Sequence(edge_features),
97
+ "entity_mention": datasets.features.Sequence(entity_features),
98
+ }
99
+ compression_features = {
100
+ "text": datasets.Value("string"),
101
+ "edge": datasets.features.Sequence(compression_edge_features),
102
+ }
103
+
104
+ return datasets.DatasetInfo(
105
+ description=_DESCRIPTION,
106
+ features=datasets.Features(
107
+ {
108
+ "graph": tree_features,
109
+ "compression": compression_features,
110
+ "headline": datasets.Value("string"),
111
+ "compression_ratio": datasets.Value("float"),
112
+ "doc_id": datasets.Value("string"),
113
+ "source_tree": tree_features,
114
+ "compression_untransformed": compression_features,
115
+ }
116
+ ),
117
+ supervised_keys=None,
118
+ homepage=_HOMEPAGE,
119
+ citation=_CITATION,
120
+ )
121
+
122
+ def _split_generators(self, dl_manager):
123
+ """Returns SplitGenerators."""
124
+ return [
125
+ datasets.SplitGenerator(
126
+ name=split,
127
+ # These kwargs will be passed to _generate_examples
128
+ gen_kwargs={"filepaths": dl_manager.download(_URLs[split])},
129
+ )
130
+ for split in _URLs
131
+ ]
132
+
133
+ def _generate_examples(self, filepaths):
134
+ """ Yields examples. """
135
+ id_ = -1
136
+ for ix, filepath in enumerate(filepaths):
137
+ with gzip.open(filepath, mode="rt", encoding="utf-8") as f:
138
+ all_text = f.read()
139
+
140
+ # in the data file, it's in the form of JSON objects, separated with '\n\n' characters
141
+ # we'll format the file to be able to read with json package
142
+ all_text = "[" + all_text + "]"
143
+ all_text = all_text.replace("}\n\n{", "},\n{")
144
+
145
+ samples = json.loads(all_text)
146
+ for sample in samples:
147
+ # add some default values
148
+ for node in sample["graph"]["node"] + sample["source_tree"]["node"]:
149
+ if "type" not in node:
150
+ node["type"] = ""
151
+ if "mid" not in node:
152
+ node["mid"] = ""
153
+
154
+ id_ += 1
155
+ yield id_, sample