cloverhxy commited on
Commit
794eecb
1 Parent(s): d2b73fb

Update semi-heter.py

Browse files
Files changed (1) hide show
  1. semi-heter.py +6 -8
semi-heter.py CHANGED
@@ -69,19 +69,17 @@ class semiHeter(datasets.GeneratorBasedBuilder):
69
  def _generate_examples(self, path_file, split):
70
  if split in ['source']:
71
  with open(path_file, "r") as f:
72
- file = f.readline()
73
- file = file[1:-1]
74
- file = file.split("}")
75
- for i in range(len(file)):
76
- yield i, {
77
- "content": json.dumps(json.loads(file[i].strip(',')+'}'))
78
- }
79
  elif split in ['target']:
80
  with open(path_file, "r") as f:
81
  file = json.load(f)
82
  for i in range(len(file)):
83
  yield i, {
84
- "content": i
85
  }
86
  else:
87
  file = pd.read_csv(path_file)
 
69
  def _generate_examples(self, path_file, split):
70
  if split in ['source']:
71
  with open(path_file, "r") as f:
72
+ file = json.load(f)
73
+ for i in range(len(file)):
74
+ yield i, {
75
+ "content": file[i]
76
+ }
 
 
77
  elif split in ['target']:
78
  with open(path_file, "r") as f:
79
  file = json.load(f)
80
  for i in range(len(file)):
81
  yield i, {
82
+ "content": file[i]
83
  }
84
  else:
85
  file = pd.read_csv(path_file)