Muennighoff commited on
Commit
465da57
1 Parent(s): e40c835
Files changed (2) hide show
  1. README.md +93 -0
  2. xstory_cloze.py +151 -0
README.md ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - found
4
+ language_creators:
5
+ - found
6
+ language:
7
+ - en
8
+ license:
9
+ - unknown
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 1K<n<10K
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - other
18
+ task_ids:
19
+ - other-other-story-completion
20
+ paperswithcode_id: null
21
+ pretty_name: Story Cloze Test
22
+ ---
23
+ # Dataset Card for "story_cloze"
24
+ ## Table of Contents
25
+ - [Dataset Description](#dataset-description)
26
+ - [Dataset Summary](#dataset-summary)
27
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
28
+ - [Languages](#languages)
29
+ - [Dataset Structure](#dataset-structure)
30
+ - [Data Instances](#data-instances)
31
+ - [Data Fields](#data-fields)
32
+ - [Data Splits](#data-splits)
33
+ - [Dataset Creation](#dataset-creation)
34
+ - [Curation Rationale](#curation-rationale)
35
+ - [Source Data](#source-data)
36
+ - [Annotations](#annotations)
37
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
38
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
39
+ - [Social Impact of Dataset](#social-impact-of-dataset)
40
+ - [Discussion of Biases](#discussion-of-biases)
41
+ - [Other Known Limitations](#other-known-limitations)
42
+ - [Additional Information](#additional-information)
43
+ - [Dataset Curators](#dataset-curators)
44
+ - [Licensing Information](#licensing-information)
45
+ - [Citation Information](#citation-information)
46
+ - [Contributions](#contributions)
47
+ ## Dataset Description
48
+ - **Homepage:** [https://cs.rochester.edu/nlp/rocstories/](https://cs.rochester.edu/nlp/rocstories/)
49
+ - **Repository:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
50
+ - **Paper:** [Lsdsem 2017 shared task: The story cloze test](https://aclanthology.org/W17-0906.pdf)
51
+ - **Point of Contact:** [Nasrin Mostafazadeh](nasrinm@cs.rochester.edu)
52
+ - **Size of downloaded dataset files:** 2.03 MB
53
+ - **Size of the generated dataset:** 2.03 MB
54
+ - **Total amount of disk used:** 2.05 MB
55
+ ### Dataset Summary
56
+ Story Cloze Test' is a new commonsense reasoning framework for evaluating story understanding,
57
+ story generation, and script learning.This test requires a system to choose the correct ending
58
+ to a four-sentence story.
59
+ ### Supported Tasks and Leaderboards
60
+ commonsense reasoning
61
+ ### Languages
62
+ English
63
+ ## Dataset Structure
64
+ ### Data Instances
65
+ - **Size of downloaded dataset files:** 2.03 MB
66
+ - **Size of the generated dataset:** 2.03 MB
67
+ - **Total amount of disk used:** 2.05 MB
68
+ An example of 'train' looks as follows.
69
+ ```
70
+ {'answer_right_ending': 1,
71
+ 'input_sentence_1': 'Rick grew up in a troubled household.',
72
+ 'input_sentence_2': 'He never found good support in family, and turned to gangs.',
73
+ 'input_sentence_3': "It wasn't long before Rick got shot in a robbery.",
74
+ 'input_sentence_4': 'The incident caused him to turn a new leaf.',
75
+ 'sentence_quiz1': 'He is happy now.',
76
+ 'sentence_quiz2': 'He joined a gang.',
77
+ 'story_id': '138d5bfb-05cc-41e3-bf2c-fa85ebad14e2'}
78
+ ```
79
+ ### Data Fields
80
+ The data fields are the same among all splits.
81
+ - `input_sentence_1`: The first statement in the story.
82
+ - `input_sentence_2`: The second statement in the story.
83
+ - `input_sentence_3`: The third statement in the story.
84
+ - `input_sentence_4`: The forth statement in the story.
85
+ - `sentence_quiz1`: first possible continuation of the story.
86
+ - `sentence_quiz2`: second possible continuation of the story.
87
+ - `answer_right_ending`: correct possible ending; either 1 or 2.
88
+ - `story_id`: story id.
89
+ ### Data Splits
90
+ | name |validation |test|
91
+ |-------|-----:|---:|
92
+ |2016|1871|1871|
93
+ |2018|1571|-|
xstory_cloze.py ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """Story Cloze datasets."""
16
+
17
+
18
+ import csv
19
+ import os
20
+
21
+ import datasets
22
+
23
+
24
+ _DESCRIPTION = """
25
+ Story Cloze Test' is a commonsense reasoning framework for evaluating story understanding,
26
+ story generation, and script learning.This test requires a system to choose the correct ending
27
+ to a four-sentence story.
28
+ """
29
+
30
+ _CITATION = """\
31
+ @article{DBLP:journals/corr/abs-2112-10668,
32
+ author = {Xi Victoria Lin and
33
+ Todor Mihaylov and
34
+ Mikel Artetxe and
35
+ Tianlu Wang and
36
+ Shuohui Chen and
37
+ Daniel Simig and
38
+ Myle Ott and
39
+ Naman Goyal and
40
+ Shruti Bhosale and
41
+ Jingfei Du and
42
+ Ramakanth Pasunuru and
43
+ Sam Shleifer and
44
+ Punit Singh Koura and
45
+ Vishrav Chaudhary and
46
+ Brian O'Horo and
47
+ Jeff Wang and
48
+ Luke Zettlemoyer and
49
+ Zornitsa Kozareva and
50
+ Mona T. Diab and
51
+ Veselin Stoyanov and
52
+ Xian Li},
53
+ title = {Few-shot Learning with Multilingual Language Models},
54
+ journal = {CoRR},
55
+ volume = {abs/2112.10668},
56
+ year = {2021},
57
+ url = {https://arxiv.org/abs/2112.10668},
58
+ eprinttype = {arXiv},
59
+ eprint = {2112.10668},
60
+ timestamp = {Tue, 04 Jan 2022 15:59:27 +0100},
61
+ biburl = {https://dblp.org/rec/journals/corr/abs-2112-10668.bib},
62
+ bibsource = {dblp computer science bibliography, https://dblp.org}
63
+ }
64
+ """
65
+
66
+
67
+ _LANG = ["ru", "zh", "es", "ar", "hi", "id", "te", "sw", "eu", "my"]
68
+ _VERSION = "1.0.0"
69
+
70
+
71
+ class XStoryCloze(datasets.GeneratorBasedBuilder):
72
+ """Story Cloze."""
73
+
74
+ BUILDER_CONFIGS = [
75
+ datasets.BuilderConfig(
76
+ name=lang,
77
+ description=f"XStory Cloze {lang}",
78
+ version=_VERSION,
79
+ )
80
+ for lang in _LANG
81
+ ]
82
+
83
+ @property
84
+ def manual_download_instructions(self):
85
+ return (
86
+ "To use Story Cloze you have to download it manually. Please fill this "
87
+ "google form (http://goo.gl/forms/aQz39sdDrO). Complete the form. "
88
+ "Then you will receive a download link for the dataset. Load it using: "
89
+ "`datasets.load_dataset('story_cloze', data_dir='path/to/folder/folder_name')`"
90
+ )
91
+
92
+ def _info(self):
93
+ return datasets.DatasetInfo(
94
+ description=_DESCRIPTION,
95
+ features=datasets.Features(
96
+ {
97
+ "story_id": datasets.Value("string"),
98
+ "input_sentence_1": datasets.Value("string"),
99
+ "input_sentence_2": datasets.Value("string"),
100
+ "input_sentence_3": datasets.Value("string"),
101
+ "input_sentence_4": datasets.Value("string"),
102
+ "sentence_quiz1": datasets.Value("string"),
103
+ "sentence_quiz2": datasets.Value("string"),
104
+ "answer_right_ending": datasets.Value("int32"),
105
+ }
106
+ ),
107
+ homepage="https://cs.rochester.edu/nlp/rocstories/",
108
+ citation=_CITATION,
109
+ )
110
+
111
+ def _split_generators(self, dl_manager):
112
+ path_to_manual_folder = os.path.abspath(os.path.expanduser(dl_manager.manual_dir))
113
+
114
+ train_file = os.path.join(path_to_manual_folder, f"spring2016.val.{self.config.name}.tsv.split_20_80_train.tsv")
115
+ val_file = os.path.join(path_to_manual_folder, f"spring2016.val.{self.config.name}.tsv.split_20_80_eval.tsv")
116
+
117
+ return [
118
+ datasets.SplitGenerator(
119
+ name=datasets.Split.TRAIN,
120
+ gen_kwargs={
121
+ "filepath": train_file,
122
+ },
123
+ ),
124
+ datasets.SplitGenerator(
125
+ name=datasets.Split.VALIDATION,
126
+ gen_kwargs={
127
+ "filepath": val_file,
128
+ },
129
+ ),
130
+ ]
131
+
132
+ def _generate_examples(self, filepath):
133
+ """Generate Story Cloze examples."""
134
+ with open(filepath, encoding="utf-8") as tsv_file:
135
+ csv_reader = csv.reader(
136
+ tsv_file, quotechar='"', delimiter="\t", quoting=csv.QUOTE_ALL, skipinitialspace=True
137
+ )
138
+ _ = next(csv_reader)
139
+ for id_, row in enumerate(csv_reader):
140
+ if row and len(row) == 8:
141
+ yield id_, {
142
+ "story_id": row[0],
143
+ "input_sentence_1": row[1],
144
+ "input_sentence_2": row[2],
145
+ "input_sentence_3": row[3],
146
+ "input_sentence_4": row[4],
147
+ "sentence_quiz1": row[5],
148
+ "sentence_quiz2": row[6],
149
+ "answer_right_ending": int(row[7]),
150
+ }
151
+