Datasets:
ArXiv:
License:
anjalyjayakrishnan
commited on
Commit
•
90646e4
1
Parent(s):
98c9703
removed tar files from data split
Browse files- snow-mountain.py +40 -41
snow-mountain.py
CHANGED
@@ -156,31 +156,32 @@ class Test(datasets.GeneratorBasedBuilder):
|
|
156 |
},
|
157 |
)
|
158 |
)
|
159 |
-
splits.append(
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
)
|
169 |
-
splits.append(
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
)
|
179 |
return splits
|
180 |
|
181 |
|
182 |
def _generate_examples(self, filepath, audio_data, dl_manager):
|
183 |
|
|
|
184 |
'''Function for parsing large csv archives (all_verses, short_verses)'''
|
185 |
def parse_archive(archive):
|
186 |
temp_df = pd.DataFrame()
|
@@ -196,25 +197,23 @@ class Test(datasets.GeneratorBasedBuilder):
|
|
196 |
break
|
197 |
return temp_df
|
198 |
|
199 |
-
if filepath.endswith('all_verses.tar.gz'):
|
200 |
-
|
201 |
-
elif filepath.endswith('short_verses.tar.gz'):
|
202 |
-
|
203 |
-
else:
|
204 |
-
with open(filepath) as f:
|
205 |
-
data_df = pd.read_csv(f,sep=',')
|
206 |
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
|
|
|
156 |
},
|
157 |
)
|
158 |
)
|
159 |
+
# splits.append(
|
160 |
+
# datasets.SplitGenerator(
|
161 |
+
# name="all_verses",
|
162 |
+
# gen_kwargs={
|
163 |
+
# "filepath": downloaded_files["all_verses"],
|
164 |
+
# "audio_data": audio_data,
|
165 |
+
# "dl_manager":dl_manager,
|
166 |
+
# },
|
167 |
+
# )
|
168 |
+
# )
|
169 |
+
# splits.append(
|
170 |
+
# datasets.SplitGenerator(
|
171 |
+
# name="short_verses",
|
172 |
+
# gen_kwargs={
|
173 |
+
# "filepath": downloaded_files["short_verses"],
|
174 |
+
# "audio_data": audio_data,
|
175 |
+
# "dl_manager":dl_manager,
|
176 |
+
# },
|
177 |
+
# )
|
178 |
+
# )
|
179 |
return splits
|
180 |
|
181 |
|
182 |
def _generate_examples(self, filepath, audio_data, dl_manager):
|
183 |
|
184 |
+
key = 0
|
185 |
'''Function for parsing large csv archives (all_verses, short_verses)'''
|
186 |
def parse_archive(archive):
|
187 |
temp_df = pd.DataFrame()
|
|
|
197 |
break
|
198 |
return temp_df
|
199 |
|
200 |
+
# if filepath.endswith('all_verses.tar.gz'):
|
201 |
+
# data_df = parse_archive(filepath)
|
202 |
+
# elif filepath.endswith('short_verses.tar.gz'):
|
203 |
+
# data_df = parse_archive(filepath)
|
|
|
|
|
|
|
204 |
|
205 |
+
with open(filepath) as f:
|
206 |
+
data_df = pd.read_csv(f,sep=',')
|
207 |
+
for index,row in data_df.iterrows():
|
208 |
+
audio = row['path'].split('/')[-1]
|
209 |
+
content = ''
|
210 |
+
if audio in list(audio_data.keys()):
|
211 |
+
content = audio_data[audio]
|
212 |
+
else:
|
213 |
+
print(f"*********** Couldn't find audio: {audio} **************")
|
214 |
+
yield key, {
|
215 |
+
"sentence": row["sentence"],
|
216 |
+
"path": row["path"],
|
217 |
+
"audio":{"path": row["path"], "bytes": content}
|
218 |
+
}
|
219 |
+
key+=1
|