wics commited on
Commit
854c71c
·
1 Parent(s): 19af8d2

Update NCR.py

Browse files
Files changed (1) hide show
  1. NCR.py +5 -1
NCR.py CHANGED
@@ -98,6 +98,10 @@ class NCR(datasets.GeneratorBasedBuilder):
98
 
99
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
100
  def _generate_examples(self, filepath, split):
 
 
 
 
101
 
102
  with open(filepath, encoding="utf-8") as f:
103
  data = json.loads(f.read())
@@ -105,7 +109,7 @@ class NCR(datasets.GeneratorBasedBuilder):
105
  questions = single_data["Questions"]
106
  for i in range(len(questions)):
107
  question = questions[i]
108
- options = [i.replace("A.","").replace("B.","").replace("C.","").replace("D.","").strip() for i in question["Choices"]]
109
  yield f"{article_idx}_{i}", {
110
  "example_id": single_data["ID"],
111
  "article": single_data["Content"],
 
98
 
99
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
100
  def _generate_examples(self, filepath, split):
101
+ def pure(sens):
102
+ if sens.startswith('A') or sens.startswith('B') or sens.startswith('C') or sens.startswith('D'):
103
+ sens = sens[1:]
104
+ return sens.replace(".","").replace(".","").strip()
105
 
106
  with open(filepath, encoding="utf-8") as f:
107
  data = json.loads(f.read())
 
109
  questions = single_data["Questions"]
110
  for i in range(len(questions)):
111
  question = questions[i]
112
+ options = [pure(i) for i in question["Choices"]]
113
  yield f"{article_idx}_{i}", {
114
  "example_id": single_data["ID"],
115
  "article": single_data["Content"],