baber commited on
Commit
55c3bf1
·
1 Parent(s): 3ff0f74

Update testing.py

Browse files
Files changed (1) hide show
  1. testing.py +13 -14
testing.py CHANGED
@@ -13,12 +13,10 @@
13
  # limitations under the License.
14
  """LogiQA dataset."""
15
 
16
-
17
  import datasets
18
  import json
19
  import ast
20
 
21
-
22
  _CITATION = """\
23
  @ARTICLE{10174688,
24
  author={Liu, Hanmeng and Liu, Jian and Cui, Leyang and Teng, Zhiyang and Duan, Nan and Zhou, Ming and Zhang, Yue},
@@ -113,7 +111,7 @@ class LogiQA2(datasets.GeneratorBasedBuilder):
113
  features = datasets.Features(
114
  {
115
  "label": datasets.Value("string"),
116
- "major_premise": datasets.Value("string"),
117
  "minor_premise": datasets.Value('string'),
118
  "conclusion": datasets.Value("string"),
119
  }
@@ -183,17 +181,18 @@ class LogiQA2(datasets.GeneratorBasedBuilder):
183
  "options": data["options"],
184
  }
185
  elif self.config.name == "logiqa2_nli":
186
- try:
187
- data["major_premise"] = ast.literal_eval(data["major_premise"])
188
- except:
189
- pass
190
-
191
- yield key, {
192
- "label": data["label"],
193
- "major_premise": data["major_premise"],
194
- "minor_premise": data["minor_premise"],
195
- "conclusion": data["conclusion"],
196
- }
 
197
 
198
  else:
199
  yield key, {
 
13
  # limitations under the License.
14
  """LogiQA dataset."""
15
 
 
16
  import datasets
17
  import json
18
  import ast
19
 
 
20
  _CITATION = """\
21
  @ARTICLE{10174688,
22
  author={Liu, Hanmeng and Liu, Jian and Cui, Leyang and Teng, Zhiyang and Duan, Nan and Zhou, Ming and Zhang, Yue},
 
111
  features = datasets.Features(
112
  {
113
  "label": datasets.Value("string"),
114
+ "major_premise": datasets.features.Sequence(datasets.Value("string")),
115
  "minor_premise": datasets.Value('string'),
116
  "conclusion": datasets.Value("string"),
117
  }
 
181
  "options": data["options"],
182
  }
183
  elif self.config.name == "logiqa2_nli":
184
+ if isinstance(data["major_premise"], str):
185
+ data["major_premise"] = [data["major_premise"]]
186
+ # output = ast.literal_eval(data["major_premise"])
187
+ # " ".join(output)
188
+ # except:
189
+ # output = data["major_premise"]
190
+ yield key, {
191
+ "label": data["label"],
192
+ "major_premise": data["major_premise"],
193
+ "minor_premise": data["minor_premise"],
194
+ "conclusion": data["conclusion"],
195
+ }
196
 
197
  else:
198
  yield key, {