王子傲 commited on
Commit
4b791bb
·
1 Parent(s): 1b209fe
Files changed (1) hide show
  1. TimeTravel.py +18 -29
TimeTravel.py CHANGED
@@ -61,7 +61,7 @@ _URLS = {
61
  class TimeTravel(datasets.GeneratorBasedBuilder):
62
  """TODO: Short description of my dataset."""
63
 
64
- VERSION = datasets.Version("1.1.0")
65
 
66
  # This is an example of a dataset with multiple configurations.
67
  # If you don't want/need to define several sub-sets in your dataset,
@@ -84,17 +84,17 @@ class TimeTravel(datasets.GeneratorBasedBuilder):
84
 
85
  def _info(self):
86
  # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
87
- features = datasets.Features(
88
- {
89
- "story_id": datasets.Value("string"),
90
- "premise": datasets.Value("string"),
91
- "initial": datasets.Value("string"),
92
- "counterfactual": datasets.Value("string"),
93
- "original_ending": datasets.Value("string"),
94
- "edited_ending": datasets.Value("string")
95
- # These are the features of your dataset like images, labels ...
96
- }
97
- )
98
  return datasets.DatasetInfo(
99
  # This is the description that will appear on the datasets page.
100
  description=_DESCRIPTION,
@@ -154,22 +154,11 @@ class TimeTravel(datasets.GeneratorBasedBuilder):
154
  with open(filepath, encoding="utf-8") as f:
155
  for key, row in enumerate(f):
156
  data = json.loads(row)
157
- if self.config.name == "unsupervised":
158
- # Yields examples as (key, example) tuples
159
- yield key, {
160
- "story_id": data["story_id"],
161
- "premise": data["premise"],
162
- "initial": data["initial"],
163
- "counterfactual": data["counterfactual"],
164
- "original_ending": data["original_ending"],
165
- "edited_ending": data["edited_ending"] if split == "test" else "",
166
- }
167
- else:
168
- yield key, {
169
  "story_id": data["story_id"],
170
- "premise": data["premise"],
171
- "initial": data["initial"],
172
- "counterfactual": data["counterfactual"],
173
- "original_ending": data["original_ending"],
174
- "edited_ending": data["edited_ending"],
175
  }
 
61
  class TimeTravel(datasets.GeneratorBasedBuilder):
62
  """TODO: Short description of my dataset."""
63
 
64
+ VERSION = datasets.Version("1.15.1")
65
 
66
  # This is an example of a dataset with multiple configurations.
67
  # If you don't want/need to define several sub-sets in your dataset,
 
84
 
85
  def _info(self):
86
  # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
87
+ features = datasets.Features(
88
+ {
89
+ "story_id": datasets.Value("string"),
90
+ "premise": datasets.Value("string"),
91
+ "initial": datasets.Value("string"),
92
+ "counterfactual": datasets.Value("string"),
93
+ "original_ending": datasets.Value("string"),
94
+ "edited_ending": datasets.Value("string")
95
+ # These are the features of your dataset like images, labels ...
96
+ }
97
+ )
98
  return datasets.DatasetInfo(
99
  # This is the description that will appear on the datasets page.
100
  description=_DESCRIPTION,
 
154
  with open(filepath, encoding="utf-8") as f:
155
  for key, row in enumerate(f):
156
  data = json.loads(row)
157
+ yield key, {
 
 
 
 
 
 
 
 
 
 
 
158
  "story_id": data["story_id"],
159
+ "premise": data["premise"],
160
+ "initial": data["initial"],
161
+ "counterfactual": data["counterfactual"],
162
+ "original_ending": data["original_ending"],
163
+ "edited_ending": data["edited_ending"],
164
  }