Datasets:

ArXiv:
License:
anjalyjayakrishnan commited on
Commit
90646e4
1 Parent(s): 98c9703

removed tar files from data split

Browse files
Files changed (1) hide show
  1. snow-mountain.py +40 -41
snow-mountain.py CHANGED
@@ -156,31 +156,32 @@ class Test(datasets.GeneratorBasedBuilder):
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
  '''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
- data_df = parse_archive(filepath)
201
- elif filepath.endswith('short_verses.tar.gz'):
202
- data_df = parse_archive(filepath)
203
- else:
204
- with open(filepath) as f:
205
- data_df = pd.read_csv(f,sep=',')
206
 
207
- key = 0
208
- for index,row in data_df.iterrows():
209
- audio = row['path'].split('/')[-1]
210
- content = ''
211
- if audio in list(audio_data.keys()):
212
- content = audio_data[audio]
213
- else:
214
- print(f"*********** Couldn't find audio: {audio} **************")
215
- yield key, {
216
- "sentence": row["sentence"],
217
- "path": row["path"],
218
- "audio":{"path": row["path"], "bytes": content}
219
- }
220
- key+=1
 
 
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