cloverhxy commited on
Commit
37e788d
1 Parent(s): 0f6ff06

Update semi-heter.py

Browse files
Files changed (1) hide show
  1. semi-heter.py +8 -1
semi-heter.py CHANGED
@@ -67,7 +67,7 @@ class semiHeter(datasets.GeneratorBasedBuilder):
67
  "path_file": dl_manager.download_and_extract(self.config.data_url), "split": "target", })]
68
 
69
  def _generate_examples(self, path_file, split):
70
- if split in ['source','target']:
71
  with open(path_file, "r") as f:
72
  file = f.readline()
73
  file = file[1:-1]
@@ -76,6 +76,13 @@ class semiHeter(datasets.GeneratorBasedBuilder):
76
  yield i, {
77
  "content": json.dumps(json.loads(file[i].strip(',')+'}'))
78
  }
 
 
 
 
 
 
 
79
  else:
80
  file = pd.read_csv(path_file)
81
  for i, row in file.iterrows():
 
67
  "path_file": dl_manager.download_and_extract(self.config.data_url), "split": "target", })]
68
 
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]
 
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 x in file:
83
+ yield i, {
84
+ "content": x
85
+ }
86
  else:
87
  file = pd.read_csv(path_file)
88
  for i, row in file.iterrows():