lukasbraach commited on
Commit
e9448e9
·
verified ·
1 Parent(s): 2197934

upd: new try

Browse files
Files changed (1) hide show
  1. rwth_phoenix_weather_2014.py +11 -11
rwth_phoenix_weather_2014.py CHANGED
@@ -94,8 +94,8 @@ class RWTHPhoenixWeather2014(datasets.GeneratorBasedBuilder):
94
  )
95
 
96
  def _split_generators(self, dl_manager: datasets.DownloadManager):
97
- dfs = {}
98
- file_ids = {}
99
 
100
  dataDirMapper = {
101
  datasets.Split.TRAIN: "train",
@@ -113,15 +113,17 @@ class RWTHPhoenixWeather2014(datasets.GeneratorBasedBuilder):
113
  data_csv = dl_manager.download(
114
  f"{base_url}/annotations/manual/{dataDirMapper[split]}{self.config.corpus_file_suffix}")
115
 
116
- dfs[split] = pd.read_csv(data_csv, sep='|')
117
- file_ids[split] = dfs[split]['id']
 
 
118
 
119
  return [
120
  datasets.SplitGenerator(
121
  name=split,
122
  gen_kwargs={
123
- "df": dfs[split],
124
- "file_ids": file_ids[split],
125
  },
126
  )
127
  for split in [
@@ -131,13 +133,11 @@ class RWTHPhoenixWeather2014(datasets.GeneratorBasedBuilder):
131
  ]
132
  ]
133
 
134
- def _generate_examples(self, df, file_ids):
135
- for key, (idx) in enumerate(zip(file_ids)):
136
- entry = df[df["id"] == idx]
137
-
138
  result = {
139
  "id": idx,
140
- "transcription": entry["annotation"],
141
  }
142
 
143
  yield key, result
 
94
  )
95
 
96
  def _split_generators(self, dl_manager: datasets.DownloadManager):
97
+ example_ids = {}
98
+ annotations = {}
99
 
100
  dataDirMapper = {
101
  datasets.Split.TRAIN: "train",
 
113
  data_csv = dl_manager.download(
114
  f"{base_url}/annotations/manual/{dataDirMapper[split]}{self.config.corpus_file_suffix}")
115
 
116
+ df = pd.read_csv(data_csv, sep='|')
117
+
118
+ example_ids[split] = df['id']
119
+ annotations[split] = df['annotation']
120
 
121
  return [
122
  datasets.SplitGenerator(
123
  name=split,
124
  gen_kwargs={
125
+ "example_ids": example_ids[split],
126
+ "annotations": annotations[split],
127
  },
128
  )
129
  for split in [
 
133
  ]
134
  ]
135
 
136
+ def _generate_examples(self, example_ids, annotations):
137
+ for key, (idx, annotation) in enumerate(zip(example_ids, annotations)):
 
 
138
  result = {
139
  "id": idx,
140
+ "transcription": annotation,
141
  }
142
 
143
  yield key, result