Commit
·
2bf31a8
0
Parent(s):
Update files from the datasets library (from 1.13.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.13.0
- .gitattributes +27 -0
- README.md +184 -0
- dataset_infos.json +1 -0
- dummy/2016/0.0.0/dummy_data.zip +3 -0
- dummy/2018/0.0.0/dummy_data.zip +3 -0
- story_cloze.py +128 -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,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- found
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
- en
|
8 |
+
licenses:
|
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 |
+
|
24 |
+
# Dataset Card for "story_cloze"
|
25 |
+
|
26 |
+
## Table of Contents
|
27 |
+
- [Dataset Description](#dataset-description)
|
28 |
+
- [Dataset Summary](#dataset-summary)
|
29 |
+
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
30 |
+
- [Languages](#languages)
|
31 |
+
- [Dataset Structure](#dataset-structure)
|
32 |
+
- [Data Instances](#data-instances)
|
33 |
+
- [Data Fields](#data-fields)
|
34 |
+
- [Data Splits](#data-splits)
|
35 |
+
- [Dataset Creation](#dataset-creation)
|
36 |
+
- [Curation Rationale](#curation-rationale)
|
37 |
+
- [Source Data](#source-data)
|
38 |
+
- [Annotations](#annotations)
|
39 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
40 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
41 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
42 |
+
- [Discussion of Biases](#discussion-of-biases)
|
43 |
+
- [Other Known Limitations](#other-known-limitations)
|
44 |
+
- [Additional Information](#additional-information)
|
45 |
+
- [Dataset Curators](#dataset-curators)
|
46 |
+
- [Licensing Information](#licensing-information)
|
47 |
+
- [Citation Information](#citation-information)
|
48 |
+
- [Contributions](#contributions)
|
49 |
+
|
50 |
+
## Dataset Description
|
51 |
+
|
52 |
+
- **Homepage:** [https://cs.rochester.edu/nlp/rocstories/](https://cs.rochester.edu/nlp/rocstories/)
|
53 |
+
- **Repository:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
54 |
+
- **Paper:** [Lsdsem 2017 shared task: The story cloze test](https://aclanthology.org/W17-0906.pdf)
|
55 |
+
- **Point of Contact:** [Nasrin Mostafazadeh]([email protected])
|
56 |
+
- **Size of downloaded dataset files:** 2.03 MB
|
57 |
+
- **Size of the generated dataset:** 2.03 MB
|
58 |
+
- **Total amount of disk used:** 2.05 MB
|
59 |
+
|
60 |
+
### Dataset Summary
|
61 |
+
|
62 |
+
Story Cloze Test' is a new commonsense reasoning framework for evaluating story understanding,
|
63 |
+
story generation, and script learning.This test requires a system to choose the correct ending
|
64 |
+
to a four-sentence story.
|
65 |
+
|
66 |
+
### Supported Tasks and Leaderboards
|
67 |
+
|
68 |
+
commonsense reasoning
|
69 |
+
|
70 |
+
### Languages
|
71 |
+
|
72 |
+
English
|
73 |
+
|
74 |
+
## Dataset Structure
|
75 |
+
|
76 |
+
### Data Instances
|
77 |
+
|
78 |
+
- **Size of downloaded dataset files:** 2.03 MB
|
79 |
+
- **Size of the generated dataset:** 2.03 MB
|
80 |
+
- **Total amount of disk used:** 2.05 MB
|
81 |
+
|
82 |
+
An example of 'train' looks as follows.
|
83 |
+
```
|
84 |
+
{'answer_right_ending': 1,
|
85 |
+
'input_sentence_1': 'Rick grew up in a troubled household.',
|
86 |
+
'input_sentence_2': 'He never found good support in family, and turned to gangs.',
|
87 |
+
'input_sentence_3': "It wasn't long before Rick got shot in a robbery.",
|
88 |
+
'input_sentence_4': 'The incident caused him to turn a new leaf.',
|
89 |
+
'sentence_quiz1': 'He is happy now.',
|
90 |
+
'sentence_quiz2': 'He joined a gang.',
|
91 |
+
'story_id': '138d5bfb-05cc-41e3-bf2c-fa85ebad14e2'}
|
92 |
+
```
|
93 |
+
|
94 |
+
### Data Fields
|
95 |
+
|
96 |
+
The data fields are the same among all splits.
|
97 |
+
|
98 |
+
- `input_sentence_1`: The first statement in the story.
|
99 |
+
- `input_sentence_2`: The second statement in the story.
|
100 |
+
- `input_sentence_3`: The third statement in the story.
|
101 |
+
- `input_sentence_4`: The forth statement in the story.
|
102 |
+
- `sentence_quiz1`: first possible continuation of the story.
|
103 |
+
- `sentence_quiz2`: second possible continuation of the story.
|
104 |
+
- `answer_right_ending`: correct possible ending; either 1 or 2.
|
105 |
+
- `story_id`: story id.
|
106 |
+
|
107 |
+
### Data Splits
|
108 |
+
|
109 |
+
| name |validation |test|
|
110 |
+
|-------|-----:|---:|
|
111 |
+
|2016|1871|1871|
|
112 |
+
|2018|1571|-|
|
113 |
+
|
114 |
+
## Dataset Creation
|
115 |
+
|
116 |
+
### Curation Rationale
|
117 |
+
|
118 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
119 |
+
|
120 |
+
### Source Data
|
121 |
+
|
122 |
+
#### Initial Data Collection and Normalization
|
123 |
+
|
124 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
125 |
+
|
126 |
+
#### Who are the source language producers?
|
127 |
+
|
128 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
129 |
+
|
130 |
+
### Annotations
|
131 |
+
|
132 |
+
#### Annotation process
|
133 |
+
|
134 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
135 |
+
|
136 |
+
#### Who are the annotators?
|
137 |
+
|
138 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
139 |
+
|
140 |
+
### Personal and Sensitive Information
|
141 |
+
|
142 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
143 |
+
|
144 |
+
## Considerations for Using the Data
|
145 |
+
|
146 |
+
### Social Impact of Dataset
|
147 |
+
|
148 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
149 |
+
|
150 |
+
### Discussion of Biases
|
151 |
+
|
152 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
153 |
+
|
154 |
+
### Other Known Limitations
|
155 |
+
|
156 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
157 |
+
|
158 |
+
## Additional Information
|
159 |
+
|
160 |
+
### Dataset Curators
|
161 |
+
|
162 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
163 |
+
|
164 |
+
### Licensing Information
|
165 |
+
|
166 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
167 |
+
|
168 |
+
### Citation Information
|
169 |
+
|
170 |
+
```
|
171 |
+
@inproceedings{mostafazadeh2017lsdsem,
|
172 |
+
title={Lsdsem 2017 shared task: The story cloze test},
|
173 |
+
author={Mostafazadeh, Nasrin and Roth, Michael and Louis, Annie and Chambers, Nathanael and Allen, James},
|
174 |
+
booktitle={Proceedings of the 2nd Workshop on Linking Models of Lexical, Sentential and Discourse-level Semantics},
|
175 |
+
pages={46--51},
|
176 |
+
year={2017}
|
177 |
+
}
|
178 |
+
|
179 |
+
```
|
180 |
+
|
181 |
+
|
182 |
+
### Contributions
|
183 |
+
|
184 |
+
Thanks to [@zaidalyafeai](https://github.com/zaidalyafeai).
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"2016": {"description": "\nStory Cloze Test' is a commonsense reasoning framework for evaluating story understanding,\nstory generation, and script learning.This test requires a system to choose the correct ending\nto a four-sentence story.\n", "citation": "@inproceedings{mostafazadeh2017lsdsem,\n title={Lsdsem 2017 shared task: The story cloze test},\n author={Mostafazadeh, Nasrin and Roth, Michael and Louis, Annie and Chambers, Nathanael and Allen, James},\n booktitle={Proceedings of the 2nd Workshop on Linking Models of Lexical, Sentential and Discourse-level Semantics},\n pages={46--51},\n year={2017}\n}\n", "homepage": "https://cs.rochester.edu/nlp/rocstories/", "license": "", "features": {"story_id": {"dtype": "string", "id": null, "_type": "Value"}, "input_sentence_1": {"dtype": "string", "id": null, "_type": "Value"}, "input_sentence_2": {"dtype": "string", "id": null, "_type": "Value"}, "input_sentence_3": {"dtype": "string", "id": null, "_type": "Value"}, "input_sentence_4": {"dtype": "string", "id": null, "_type": "Value"}, "sentence_quiz1": {"dtype": "string", "id": null, "_type": "Value"}, "sentence_quiz2": {"dtype": "string", "id": null, "_type": "Value"}, "answer_right_ending": {"dtype": "int32", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "story_cloze", "config_name": "2016", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"validation": {"name": "validation", "num_bytes": 614084, "num_examples": 1871, "dataset_name": "story_cloze"}, "test": {"name": "test", "num_bytes": 613184, "num_examples": 1871, "dataset_name": "story_cloze"}}, "download_checksums": {}, "download_size": 0, "post_processing_size": null, "dataset_size": 1227268, "size_in_bytes": 1227268}, "2018": {"description": "\nStory Cloze Test' is a commonsense reasoning framework for evaluating story understanding,\nstory generation, and script learning.This test requires a system to choose the correct ending\nto a four-sentence story.\n", "citation": "@inproceedings{mostafazadeh2017lsdsem,\n title={Lsdsem 2017 shared task: The story cloze test},\n author={Mostafazadeh, Nasrin and Roth, Michael and Louis, Annie and Chambers, Nathanael and Allen, James},\n booktitle={Proceedings of the 2nd Workshop on Linking Models of Lexical, Sentential and Discourse-level Semantics},\n pages={46--51},\n year={2017}\n}\n", "homepage": "https://cs.rochester.edu/nlp/rocstories/", "license": "", "features": {"story_id": {"dtype": "string", "id": null, "_type": "Value"}, "input_sentence_1": {"dtype": "string", "id": null, "_type": "Value"}, "input_sentence_2": {"dtype": "string", "id": null, "_type": "Value"}, "input_sentence_3": {"dtype": "string", "id": null, "_type": "Value"}, "input_sentence_4": {"dtype": "string", "id": null, "_type": "Value"}, "sentence_quiz1": {"dtype": "string", "id": null, "_type": "Value"}, "sentence_quiz2": {"dtype": "string", "id": null, "_type": "Value"}, "answer_right_ending": {"dtype": "int32", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "story_cloze", "config_name": "2018", "version": "0.0.0", "splits": {"validation": {"name": "validation", "num_bytes": 515439, "num_examples": 1571, "dataset_name": "story_cloze"}}, "download_checksums": {}, "download_size": 0, "post_processing_size": null, "dataset_size": 515439, "size_in_bytes": 515439}}
|
dummy/2016/0.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:aeab74f37efe821f207605d89b127badb8bb2b4a08d8a2dea935d2b84ae348fb
|
3 |
+
size 2592
|
dummy/2018/0.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9a49d1dc27a4b81737a94da8694ef2d7d6c20d44ace2fd040483ab0e48872f8d
|
3 |
+
size 1350
|
story_cloze.py
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
@inproceedings{mostafazadeh2017lsdsem,
|
32 |
+
title={Lsdsem 2017 shared task: The story cloze test},
|
33 |
+
author={Mostafazadeh, Nasrin and Roth, Michael and Louis, Annie and Chambers, Nathanael and Allen, James},
|
34 |
+
booktitle={Proceedings of the 2nd Workshop on Linking Models of Lexical, Sentential and Discourse-level Semantics},
|
35 |
+
pages={46--51},
|
36 |
+
year={2017}
|
37 |
+
}
|
38 |
+
"""
|
39 |
+
|
40 |
+
|
41 |
+
class StoryCloze(datasets.GeneratorBasedBuilder):
|
42 |
+
"""Story Cloze."""
|
43 |
+
|
44 |
+
BUILDER_CONFIGS = [
|
45 |
+
datasets.BuilderConfig(name="2016", description="Story Cloze Test Spring 2016 set"),
|
46 |
+
datasets.BuilderConfig(name="2018", description="Story Cloze Test Winter 2018 set"),
|
47 |
+
]
|
48 |
+
|
49 |
+
@property
|
50 |
+
def manual_download_instructions(self):
|
51 |
+
return (
|
52 |
+
"To use Story Cloze you have to download it manually. Please fill this "
|
53 |
+
"google form (http://goo.gl/forms/aQz39sdDrO). Complete the form. "
|
54 |
+
"Then you will recieve a download link for the dataset. Load it using: "
|
55 |
+
"`datasets.load_dataset('story_cloze', data_dir='path/to/folder/folder_name')`"
|
56 |
+
)
|
57 |
+
|
58 |
+
def _info(self):
|
59 |
+
return datasets.DatasetInfo(
|
60 |
+
description=_DESCRIPTION,
|
61 |
+
features=datasets.Features(
|
62 |
+
{
|
63 |
+
"story_id": datasets.Value("string"),
|
64 |
+
"input_sentence_1": datasets.Value("string"),
|
65 |
+
"input_sentence_2": datasets.Value("string"),
|
66 |
+
"input_sentence_3": datasets.Value("string"),
|
67 |
+
"input_sentence_4": datasets.Value("string"),
|
68 |
+
"sentence_quiz1": datasets.Value("string"),
|
69 |
+
"sentence_quiz2": datasets.Value("string"),
|
70 |
+
"answer_right_ending": datasets.Value("int32"),
|
71 |
+
}
|
72 |
+
),
|
73 |
+
homepage="https://cs.rochester.edu/nlp/rocstories/",
|
74 |
+
citation=_CITATION,
|
75 |
+
)
|
76 |
+
|
77 |
+
def _split_generators(self, dl_manager):
|
78 |
+
path_to_manual_folder = os.path.abspath(os.path.expanduser(dl_manager.manual_dir))
|
79 |
+
|
80 |
+
if self.config.name == "2016":
|
81 |
+
test_file = os.path.join(path_to_manual_folder, "cloze_test_test__spring2016 - cloze_test_ALL_test.csv")
|
82 |
+
val_file = os.path.join(path_to_manual_folder, "cloze_test_val__spring2016 - cloze_test_ALL_val.csv")
|
83 |
+
return [
|
84 |
+
datasets.SplitGenerator(
|
85 |
+
name=datasets.Split.VALIDATION,
|
86 |
+
gen_kwargs={
|
87 |
+
"filepath": val_file,
|
88 |
+
},
|
89 |
+
),
|
90 |
+
datasets.SplitGenerator(
|
91 |
+
name=datasets.Split.TEST,
|
92 |
+
gen_kwargs={
|
93 |
+
"filepath": test_file,
|
94 |
+
},
|
95 |
+
),
|
96 |
+
]
|
97 |
+
|
98 |
+
else:
|
99 |
+
val_file = os.path.join(path_to_manual_folder, "cloze_test_val__winter2018-cloze_test_ALL_val - 1 - 1.csv")
|
100 |
+
|
101 |
+
return [
|
102 |
+
datasets.SplitGenerator(
|
103 |
+
name=datasets.Split.VALIDATION,
|
104 |
+
gen_kwargs={
|
105 |
+
"filepath": val_file,
|
106 |
+
},
|
107 |
+
),
|
108 |
+
]
|
109 |
+
|
110 |
+
def _generate_examples(self, filepath):
|
111 |
+
"""Generate Story Cloze examples."""
|
112 |
+
with open(filepath, encoding="utf-8") as csv_file:
|
113 |
+
csv_reader = csv.reader(
|
114 |
+
csv_file, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True
|
115 |
+
)
|
116 |
+
_ = next(csv_reader)
|
117 |
+
for id_, row in enumerate(csv_reader):
|
118 |
+
if row and len(row) == 8:
|
119 |
+
yield id_, {
|
120 |
+
"story_id": row[0],
|
121 |
+
"input_sentence_1": row[1],
|
122 |
+
"input_sentence_2": row[2],
|
123 |
+
"input_sentence_3": row[3],
|
124 |
+
"input_sentence_4": row[4],
|
125 |
+
"sentence_quiz1": row[5],
|
126 |
+
"sentence_quiz2": row[6],
|
127 |
+
"answer_right_ending": int(row[7]),
|
128 |
+
}
|