Datasets:

Tasks:
Other
Modalities:
Text
ArXiv:
Libraries:
Datasets
License:
juletxara commited on
Commit
4af00b2
1 Parent(s): 58be076

add dataset files and loading script

Browse files
spring2016.val.ar.tsv.split_20_80_eval.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.ar.tsv.split_20_80_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.en.tsv.split_20_80_eval.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.en.tsv.split_20_80_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.es.tsv.split_20_80_eval.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.es.tsv.split_20_80_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.eu.tsv.split_20_80_eval.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.eu.tsv.split_20_80_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.hi.tsv.split_20_80_eval.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.hi.tsv.split_20_80_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.id.tsv.split_20_80_eval.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.id.tsv.split_20_80_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.my.tsv.split_20_80_eval.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.my.tsv.split_20_80_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.ru.tsv.split_20_80_eval.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.ru.tsv.split_20_80_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.sw.tsv.split_20_80_eval.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.sw.tsv.split_20_80_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.te.tsv.split_20_80_eval.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.te.tsv.split_20_80_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.zh.tsv.split_20_80_eval.tsv ADDED
The diff for this file is too large to render. See raw diff
 
spring2016.val.zh.tsv.split_20_80_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
xstory_cloze.py ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """XStoryCloze dataset."""
16
+
17
+
18
+ import csv
19
+ import os
20
+
21
+ import datasets
22
+
23
+
24
+ _DESCRIPTION = """
25
+ XStoryCloze consists of the professionally translated version of the [English StoryCloze dataset](https://cs.rochester.edu/nlp/rocstories/) (Spring 2016 version) to 10 non-English languages. This dataset is released by Meta AI.
26
+ """
27
+
28
+ _CITATION = """\
29
+ @article{DBLP:journals/corr/abs-2112-10668,
30
+ author = {Xi Victoria Lin and
31
+ Todor Mihaylov and
32
+ Mikel Artetxe and
33
+ Tianlu Wang and
34
+ Shuohui Chen and
35
+ Daniel Simig and
36
+ Myle Ott and
37
+ Naman Goyal and
38
+ Shruti Bhosale and
39
+ Jingfei Du and
40
+ Ramakanth Pasunuru and
41
+ Sam Shleifer and
42
+ Punit Singh Koura and
43
+ Vishrav Chaudhary and
44
+ Brian O'Horo and
45
+ Jeff Wang and
46
+ Luke Zettlemoyer and
47
+ Zornitsa Kozareva and
48
+ Mona T. Diab and
49
+ Veselin Stoyanov and
50
+ Xian Li},
51
+ title = {Few-shot Learning with Multilingual Language Models},
52
+ journal = {CoRR},
53
+ volume = {abs/2112.10668},
54
+ year = {2021},
55
+ url = {https://arxiv.org/abs/2112.10668},
56
+ eprinttype = {arXiv},
57
+ eprint = {2112.10668},
58
+ timestamp = {Tue, 04 Jan 2022 15:59:27 +0100},
59
+ biburl = {https://dblp.org/rec/journals/corr/abs-2112-10668.bib},
60
+ bibsource = {dblp computer science bibliography, https://dblp.org}
61
+ }
62
+ """
63
+
64
+ _LANG = ["en", "ru", "zh", "es", "ar", "hi", "id", "te", "sw", "eu", "my"]
65
+ _URL_FORMAT = "spring2016.val.{lang}.tsv.split_20_80_{split}.tsv"
66
+
67
+
68
+ class XStoryCloze(datasets.GeneratorBasedBuilder):
69
+ """XStoryCloze."""
70
+
71
+ BUILDER_CONFIGS = [
72
+ datasets.BuilderConfig(name=lang,
73
+ description="XStoryCloze Test Spring 2016 {lang} set")
74
+ for lang in _LANG
75
+ ]
76
+
77
+ def _info(self):
78
+ return datasets.DatasetInfo(
79
+ description=_DESCRIPTION,
80
+ features=datasets.Features(
81
+ {
82
+ "story_id": datasets.Value("string"),
83
+ "input_sentence_1": datasets.Value("string"),
84
+ "input_sentence_2": datasets.Value("string"),
85
+ "input_sentence_3": datasets.Value("string"),
86
+ "input_sentence_4": datasets.Value("string"),
87
+ "sentence_quiz1": datasets.Value("string"),
88
+ "sentence_quiz2": datasets.Value("string"),
89
+ "answer_right_ending": datasets.Value("int32"),
90
+ }
91
+ ),
92
+ homepage="https://cs.rochester.edu/nlp/rocstories/",
93
+ citation=_CITATION,
94
+ )
95
+
96
+ def _split_generators(self, dl_manager):
97
+ name = self.config.name
98
+
99
+ filepaths = dl_manager.download_and_extract({
100
+ "train": _URL_FORMAT.format(lang=name, split="train"),
101
+ "eval": _URL_FORMAT.format(lang=name, split="eval"),
102
+ })
103
+
104
+ return [
105
+ datasets.SplitGenerator(
106
+ name=split,
107
+ # These kwargs will be passed to _generate_examples
108
+ gen_kwargs={"filepath": path},
109
+ ) for split, path in filepaths.items()
110
+ ]
111
+
112
+ def _generate_examples(self, filepath):
113
+ """Generate XStoryCloze examples."""
114
+ with open(filepath, encoding="utf-8") as csv_file:
115
+ csv_reader = csv.reader(
116
+ csv_file, quotechar='"', delimiter="\t", quoting=csv.QUOTE_ALL, skipinitialspace=True
117
+ )
118
+ _ = next(csv_reader)
119
+ for id_, row in enumerate(csv_reader):
120
+ if row and len(row) == 8:
121
+ yield id_, {
122
+ "story_id": row[0],
123
+ "input_sentence_1": row[1],
124
+ "input_sentence_2": row[2],
125
+ "input_sentence_3": row[3],
126
+ "input_sentence_4": row[4],
127
+ "sentence_quiz1": row[5],
128
+ "sentence_quiz2": row[6],
129
+ "answer_right_ending": int(row[7]),
130
+ }