sergioburdisso commited on
Commit
5008aa3
1 Parent(s): 66eb780

Update dialog2flow-dataset.py

Browse files
Files changed (1) hide show
  1. dialog2flow-dataset.py +2 -2
dialog2flow-dataset.py CHANGED
@@ -184,7 +184,7 @@ class Dialog2FlowBuilder(GeneratorBasedBuilder):
184
 
185
  def _load_json(self, file_path):
186
  with open(file_path, encoding="utf-8") as f:
187
- data = json.loads(f.read())
188
  return data
189
 
190
  def _generate_examples(self, file_path, split, split_name=None):
@@ -192,7 +192,7 @@ class Dialog2FlowBuilder(GeneratorBasedBuilder):
192
  data = self._load_json(file_path)
193
  data = [(dial_id, dial) for dial_id, dial in data["dialogs"].items() if split_name in dial_id]
194
  logger.info(f"generating {len(data)} examples from = {split}")
195
- for dial_id, dial in data.items():
196
  yield dial_id, {"dialog": dial}
197
  else:
198
  pass
 
184
 
185
  def _load_json(self, file_path):
186
  with open(file_path, encoding="utf-8") as f:
187
+ data = json.load(f)
188
  return data
189
 
190
  def _generate_examples(self, file_path, split, split_name=None):
 
192
  data = self._load_json(file_path)
193
  data = [(dial_id, dial) for dial_id, dial in data["dialogs"].items() if split_name in dial_id]
194
  logger.info(f"generating {len(data)} examples from = {split}")
195
+ for dial_id, dial in data:
196
  yield dial_id, {"dialog": dial}
197
  else:
198
  pass