xiaojuan0920 commited on
Commit
cb25a68
1 Parent(s): f695a96

Update cskg_2.py

Browse files
Files changed (1) hide show
  1. cskg_2.py +13 -5
cskg_2.py CHANGED
@@ -165,12 +165,17 @@ class cskg_2(datasets.GeneratorBasedBuilder):
165
  def _generate_examples(self, filepath, split):
166
  # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
167
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
168
- with open(filepath, encoding="utf-8") as f:
169
- for key, row in enumerate(f):
170
- row = row.split(b"\t")
 
 
 
171
  if self.config.name == "cskg":
 
 
172
  # Yields examples as (key, example) tuples
173
- yield key, {
174
  # "sentence": data["sentence"],
175
  # "option1": data["option1"],
176
  # "answer": "" if split == "test" else data["answer"],
@@ -191,4 +196,7 @@ class cskg_2(datasets.GeneratorBasedBuilder):
191
  # "sentence": data["sentence"],
192
  # "option2": data["option2"],
193
  # "second_domain_answer": "" if split == "test" else data["second_domain_answer"],
194
- # }
 
 
 
 
165
  def _generate_examples(self, filepath, split):
166
  # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
167
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
168
+ # jump the first row
169
+
170
+ with open(filepath, 'rb') as f:
171
+ for id_, row in enumerate(f):
172
+ if id_ == 0:
173
+ continue
174
  if self.config.name == "cskg":
175
+ row = row.split(b"\t")
176
+
177
  # Yields examples as (key, example) tuples
178
+ yield id_, {
179
  # "sentence": data["sentence"],
180
  # "option1": data["option1"],
181
  # "answer": "" if split == "test" else data["answer"],
 
196
  # "sentence": data["sentence"],
197
  # "option2": data["option2"],
198
  # "second_domain_answer": "" if split == "test" else data["second_domain_answer"],
199
+ # }
200
+
201
+
202
+