Datasets:

ArXiv:
License:
Anjaly commited on
Commit
0b79e5b
·
1 Parent(s): 83556fc

supporting audio zip files

Browse files
Files changed (1) hide show
  1. snow-mountain.py +10 -5
snow-mountain.py CHANGED
@@ -18,6 +18,7 @@ import os
18
  import csv
19
  import json
20
  import datasets
 
21
  import pandas as pd
22
  from scipy.io import wavfile
23
 
@@ -136,13 +137,17 @@ class Test(datasets.GeneratorBasedBuilder):
136
  data_df = pd.read_csv(f,sep=',')
137
  transcripts = []
138
  for index,row in data_df.iterrows():
 
139
  zip_url = '/'.join(row["path"].split('/')[:-1])+'.zip'
140
  archive_path = dl_manager.download(zip_url)
141
- for path, file in dl_manager.iter_archive(archive_path):
142
- content = path.read()
143
- # if file in str(row["path"]):
144
- # content = file.read()
145
- # break
 
 
 
146
  yield key, {
147
  "sentence": row["sentence"],
148
  "path": row["path"],
 
18
  import csv
19
  import json
20
  import datasets
21
+ import zipfile
22
  import pandas as pd
23
  from scipy.io import wavfile
24
 
 
137
  data_df = pd.read_csv(f,sep=',')
138
  transcripts = []
139
  for index,row in data_df.iterrows():
140
+ audio = row['path'].split('/')[-1]
141
  zip_url = '/'.join(row["path"].split('/')[:-1])+'.zip'
142
  archive_path = dl_manager.download(zip_url)
143
+ zip_f = zipfile.ZipFile(archive_path)
144
+ f = zip_f.open(audio)
145
+ content = f.read()
146
+ # for path, file in dl_manager.iter_archive(archive_path):
147
+ # content = path.read()
148
+ # # if file in str(row["path"]):
149
+ # # content = file.read()
150
+ # # break
151
  yield key, {
152
  "sentence": row["sentence"],
153
  "path": row["path"],