Datasets:
aembryonic
commited on
Commit
•
e3342b7
1
Parent(s):
c8de64c
add version 2
Browse files
humset.py
CHANGED
@@ -47,25 +47,26 @@ _URLs = {
|
|
47 |
"train": "data/train.jsonl",
|
48 |
"dev": "data/validation.jsonl",
|
49 |
"test": "data/test.jsonl",
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
}
|
52 |
|
53 |
|
54 |
_SUPPORTED_VERSIONS = [
|
55 |
-
#
|
56 |
datasets.Version("1.0.0", "Only primary tags"),
|
57 |
-
#
|
58 |
-
|
59 |
-
# Having the model predict newline separators makes it easier to evaluate
|
60 |
-
# using summary-level ROUGE.
|
61 |
-
#datasets.Version("2.0.0", "Separate target sentences with newline."),
|
62 |
]
|
63 |
|
64 |
-
|
65 |
-
DEFAULT_CONFIG_NAME = "1.0.0" #datasets.Version("1.0", "Using cased version.")
|
66 |
|
67 |
## COMMON FEATURES
|
68 |
-
|
69 |
{
|
70 |
"entry_id": datasets.Value("string"),
|
71 |
"lead_id": datasets.Value("string"),
|
@@ -186,6 +187,34 @@ MAIN_FEATURES = datasets.Features(
|
|
186 |
)
|
187 |
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
class HumsetConfig(datasets.BuilderConfig):
|
190 |
"""BuilderConfig for DuoRC SelfRC."""
|
191 |
|
@@ -198,7 +227,6 @@ class HumsetConfig(datasets.BuilderConfig):
|
|
198 |
|
199 |
|
200 |
class Humset(datasets.GeneratorBasedBuilder):
|
201 |
-
"""DuoRC Dataset"""
|
202 |
|
203 |
BUILDER_CONFIGS = [
|
204 |
HumsetConfig(
|
@@ -216,7 +244,17 @@ class Humset(datasets.GeneratorBasedBuilder):
|
|
216 |
# This is the description that will appear on the datasets page.
|
217 |
description=_DESCRIPTION,
|
218 |
# This defines the different columns of the dataset and their types
|
219 |
-
features=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
homepage=_HOMEPAGE,
|
221 |
license=_LICENSE,
|
222 |
citation=_CITATION,
|
@@ -260,26 +298,3 @@ class Humset(datasets.GeneratorBasedBuilder):
|
|
260 |
if self.config.name == "1.0.0":
|
261 |
yield idx, row
|
262 |
idx+=1
|
263 |
-
#for example in duorc:
|
264 |
-
|
265 |
-
|
266 |
-
"""
|
267 |
-
plot_id = example["id"]
|
268 |
-
plot = example["plot"].strip()
|
269 |
-
title = example["title"].strip()
|
270 |
-
for qas in example["qa"]:
|
271 |
-
question_id = qas["id"]
|
272 |
-
question = qas["question"].strip()
|
273 |
-
answers = [answer.strip() for answer in qas["answers"]]
|
274 |
-
no_answer = qas["no_answer"]
|
275 |
-
|
276 |
-
yield question_id, {
|
277 |
-
"title": title,
|
278 |
-
"plot": plot,
|
279 |
-
"question": question,
|
280 |
-
"plot_id": plot_id,
|
281 |
-
"question_id": question_id,
|
282 |
-
"answers": answers,
|
283 |
-
"no_answer": no_answer,
|
284 |
-
}
|
285 |
-
"""
|
|
|
47 |
"train": "data/train.jsonl",
|
48 |
"dev": "data/validation.jsonl",
|
49 |
"test": "data/test.jsonl",
|
50 |
+
},
|
51 |
+
"2.0.0": {
|
52 |
+
"train": "data/train_1_1.jsonl",
|
53 |
+
"dev": "data/validation_1_1_.jsonl",
|
54 |
+
"test": "data/test_1_1.jsonl"
|
55 |
}
|
56 |
}
|
57 |
|
58 |
|
59 |
_SUPPORTED_VERSIONS = [
|
60 |
+
# First version
|
61 |
datasets.Version("1.0.0", "Only primary tags"),
|
62 |
+
# Second version
|
63 |
+
datasets.Version("2.0.0", "Extented data points including secondary tags and geolocations"),
|
|
|
|
|
|
|
64 |
]
|
65 |
|
66 |
+
DEFAULT_CONFIG_NAME = "2.0.0"
|
|
|
67 |
|
68 |
## COMMON FEATURES
|
69 |
+
FIRST_FEATURES = datasets.Features(
|
70 |
{
|
71 |
"entry_id": datasets.Value("string"),
|
72 |
"lead_id": datasets.Value("string"),
|
|
|
187 |
)
|
188 |
|
189 |
|
190 |
+
SECOND_FEATURES = datasets.Features(
|
191 |
+
{
|
192 |
+
"entry_id": datasets.Value("string"),
|
193 |
+
"lead_id": datasets.Value("string"),
|
194 |
+
"lang": datasets.Value("string"),
|
195 |
+
"n_tokens": datasets.Value("int64"),
|
196 |
+
"project_title": datasets.Value("string"),
|
197 |
+
"created_at": datasets.Value("string"),
|
198 |
+
"document": datasets.Value("string"),
|
199 |
+
"source_title": datasets.Value("string"),
|
200 |
+
"author_title": datasets.Value("string"),
|
201 |
+
"excerpt": datasets.Value("string"),
|
202 |
+
"geo_location": datasets.Sequence(datasets.Value("string"), length=-1),
|
203 |
+
"sectors": datasets.Sequence(datasets.Value("string"), length=-1),
|
204 |
+
"pillars_1d": datasets.Sequence(datasets.Value("string"), length=-1),
|
205 |
+
"pillars_2d": datasets.Sequence(datasets.Value("string"), length=-1),
|
206 |
+
"subpillars_1d": datasets.Sequence(datasets.Value("string"), length=-1),
|
207 |
+
"subpillars_2d": datasets.Sequence(datasets.Value("string"), length=-1),
|
208 |
+
"displaced": datasets.Sequence(datasets.Value("string"), length=-1),
|
209 |
+
"non_displaced": datasets.Sequence(datasets.Value("string"), length=-1),
|
210 |
+
"affected": datasets.Sequence(datasets.Value("string"), length=-1),
|
211 |
+
"severity": datasets.Sequence(datasets.Value("string"), length=-1),
|
212 |
+
"age": datasets.Sequence(datasets.Value("string"), length=-1),
|
213 |
+
"gender": datasets.Sequence(datasets.Value("string"), length=-1),
|
214 |
+
"specific_needs_groups": datasets.Sequence(datasets.Value("string"), length=-1)
|
215 |
+
}
|
216 |
+
)
|
217 |
+
|
218 |
class HumsetConfig(datasets.BuilderConfig):
|
219 |
"""BuilderConfig for DuoRC SelfRC."""
|
220 |
|
|
|
227 |
|
228 |
|
229 |
class Humset(datasets.GeneratorBasedBuilder):
|
|
|
230 |
|
231 |
BUILDER_CONFIGS = [
|
232 |
HumsetConfig(
|
|
|
244 |
# This is the description that will appear on the datasets page.
|
245 |
description=_DESCRIPTION,
|
246 |
# This defines the different columns of the dataset and their types
|
247 |
+
features=FIRST_FEATURES,
|
248 |
+
homepage=_HOMEPAGE,
|
249 |
+
license=_LICENSE,
|
250 |
+
citation=_CITATION,
|
251 |
+
)
|
252 |
+
elif self.config.name == "2.0.0":
|
253 |
+
return datasets.DatasetInfo(
|
254 |
+
# This is the description that will appear on the datasets page.
|
255 |
+
description=_DESCRIPTION,
|
256 |
+
# This defines the different columns of the dataset and their types
|
257 |
+
features=SECOND_FEATURES,
|
258 |
homepage=_HOMEPAGE,
|
259 |
license=_LICENSE,
|
260 |
citation=_CITATION,
|
|
|
298 |
if self.config.name == "1.0.0":
|
299 |
yield idx, row
|
300 |
idx+=1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|