Update ami-ihm-asr.py
Browse files- ami-ihm-asr.py +13 -3
ami-ihm-asr.py
CHANGED
@@ -88,6 +88,8 @@ class ami_ihm_asr(datasets.GeneratorBasedBuilder):
|
|
88 |
urls = deepcopy(URLS["ctc-large"])
|
89 |
if "xlsr" in self.config.name:
|
90 |
urls = deepcopy(URLS["xlsr"])
|
|
|
|
|
91 |
|
92 |
dl_path = dl_manager.download_and_extract(urls)
|
93 |
|
@@ -128,22 +130,30 @@ class ami_ihm_asr(datasets.GeneratorBasedBuilder):
|
|
128 |
# window considering front and rear contexts
|
129 |
if split == "train":
|
130 |
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)
|
|
|
131 |
windowed_texts = windowed(texts, self.config.n_bodies)
|
132 |
else:
|
133 |
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)
|
|
|
134 |
windowed_texts = windowed(texts, self.config.n_bodies, fillvalue='', step=self.config.n_bodies)
|
135 |
|
136 |
-
for text_asr, text, utt in zip(windowed_texts_asr, windowed_texts, utterances):
|
137 |
src = ''
|
138 |
if self.config.n_fronts > 0:
|
139 |
src += self.config.front_prefix
|
140 |
-
|
|
|
|
|
|
|
141 |
src += '\n'
|
142 |
src += self.config.body_prefix
|
143 |
src += '\n'.join(text_asr[self.config.n_fronts:self.config.n_fronts + self.config.n_bodies])
|
144 |
if self.config.n_rears > 0:
|
145 |
src += '\n' + self.config.rear_prefix
|
146 |
-
|
|
|
|
|
|
|
147 |
tgt = '\n'.join(text)
|
148 |
|
149 |
data = {
|
|
|
88 |
urls = deepcopy(URLS["ctc-large"])
|
89 |
if "xlsr" in self.config.name:
|
90 |
urls = deepcopy(URLS["xlsr"])
|
91 |
+
if "ctc-large-oracle" in self.config.name:
|
92 |
+
urls = deepcopy(URLS["ctc-large"])
|
93 |
|
94 |
dl_path = dl_manager.download_and_extract(urls)
|
95 |
|
|
|
130 |
# window considering front and rear contexts
|
131 |
if split == "train":
|
132 |
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)
|
133 |
+
windowed_oracles = windowed([''] * self.config.n_fronts + texts + [''] * self.config.n_rears, self.config.n_bodies + self.config.n_fronts + self.config.n_rears)
|
134 |
windowed_texts = windowed(texts, self.config.n_bodies)
|
135 |
else:
|
136 |
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)
|
137 |
+
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)
|
138 |
windowed_texts = windowed(texts, self.config.n_bodies, fillvalue='', step=self.config.n_bodies)
|
139 |
|
140 |
+
for text_asr, text, oracle, utt in zip(windowed_texts_asr, windowed_texts, windowed_oracles, utterances):
|
141 |
src = ''
|
142 |
if self.config.n_fronts > 0:
|
143 |
src += self.config.front_prefix
|
144 |
+
if "oracle" in self.config.name:
|
145 |
+
src += '\n'.join(oracle[:self.config.n_fronts])
|
146 |
+
else:
|
147 |
+
src += '\n'.join(text_asr[:self.config.n_fronts])
|
148 |
src += '\n'
|
149 |
src += self.config.body_prefix
|
150 |
src += '\n'.join(text_asr[self.config.n_fronts:self.config.n_fronts + self.config.n_bodies])
|
151 |
if self.config.n_rears > 0:
|
152 |
src += '\n' + self.config.rear_prefix
|
153 |
+
if "oracle" in self.config.name:
|
154 |
+
src += '\n'.join(oracle[self.config.n_fronts + self.config.n_bodies:])
|
155 |
+
else:
|
156 |
+
src += '\n'.join(text_asr[self.config.n_fronts + self.config.n_bodies:])
|
157 |
tgt = '\n'.join(text)
|
158 |
|
159 |
data = {
|