Padomin commited on
Commit
ac1d3a9
1 Parent(s): c77b571

Update coraal-asr.py

Browse files
Files changed (1) hide show
  1. coraal-asr.py +5 -3
coraal-asr.py CHANGED
@@ -146,17 +146,19 @@ class coraal_asr(datasets.GeneratorBasedBuilder):
146
  # window considering front and rear contexts
147
  if split == "train":
148
  windowed_texts_asr = windowed([''] * self.config.n_fronts + texts_asr + [''] * self.config.n_rears, self.config.n_bodies + self.config.n_fronts + self.config.n_rears)
 
149
  windowed_texts = windowed(texts, self.config.n_bodies)
150
  else:
151
  windowed_texts_asr = windowed([''] * self.config.n_fronts + texts_asr + [''] * self.config.n_rears, self.config.n_bodies + self.config.n_fronts + self.config.n_rears, fillvalue='', step=self.config.n_bodies)
 
152
  windowed_texts = windowed(texts, self.config.n_bodies, fillvalue='', step=self.config.n_bodies)
153
 
154
- for text_asr, text, utt in zip(windowed_texts_asr, windowed_texts, utterances):
155
  src = ''
156
  if self.config.n_fronts > 0:
157
  src += self.config.front_prefix
158
  if "oracle" in self.config.name:
159
- src += '\n'.join(text[:self.config.n_fronts])
160
  else:
161
  src += '\n'.join(text_asr[:self.config.n_fronts])
162
  src += '\n'
@@ -165,7 +167,7 @@ class coraal_asr(datasets.GeneratorBasedBuilder):
165
  if self.config.n_rears > 0:
166
  src += '\n' + self.config.rear_prefix
167
  if "oracle" in self.config.name:
168
- src += '\n'.join(text[self.config.n_fronts + self.config.n_bodies:])
169
  else:
170
  src += '\n'.join(text_asr[self.config.n_fronts + self.config.n_bodies:])
171
  tgt = '\n'.join(text)
 
146
  # window considering front and rear contexts
147
  if split == "train":
148
  windowed_texts_asr = windowed([''] * self.config.n_fronts + texts_asr + [''] * self.config.n_rears, self.config.n_bodies + self.config.n_fronts + self.config.n_rears)
149
+ windowed_oracles = windowed([''] * self.config.n_fronts + texts + [''] * self.config.n_rears, self.config.n_bodies + self.config.n_fronts + self.config.n_rears)
150
  windowed_texts = windowed(texts, self.config.n_bodies)
151
  else:
152
  windowed_texts_asr = windowed([''] * self.config.n_fronts + texts_asr + [''] * self.config.n_rears, self.config.n_bodies + self.config.n_fronts + self.config.n_rears, fillvalue='', step=self.config.n_bodies)
153
+ windowed_oracles = windowed([''] * self.config.n_fronts + texts + [''] * self.config.n_rears, self.config.n_bodies + self.config.n_fronts + self.config.n_rears, fillvalue='', step=self.config.n_bodies)
154
  windowed_texts = windowed(texts, self.config.n_bodies, fillvalue='', step=self.config.n_bodies)
155
 
156
+ for text_asr, text, oracle, utt in zip(windowed_texts_asr, windowed_texts, windowed_oracles, utterances):
157
  src = ''
158
  if self.config.n_fronts > 0:
159
  src += self.config.front_prefix
160
  if "oracle" in self.config.name:
161
+ src += '\n'.join(oracle[:self.config.n_fronts])
162
  else:
163
  src += '\n'.join(text_asr[:self.config.n_fronts])
164
  src += '\n'
 
167
  if self.config.n_rears > 0:
168
  src += '\n' + self.config.rear_prefix
169
  if "oracle" in self.config.name:
170
+ src += '\n'.join(oracle[self.config.n_fronts + self.config.n_bodies:])
171
  else:
172
  src += '\n'.join(text_asr[self.config.n_fronts + self.config.n_bodies:])
173
  tgt = '\n'.join(text)