gigant commited on
Commit
005aa9e
1 Parent(s): ee23015

Update m-ailabs_speech_dataset_fr.py

Browse files
Files changed (1) hide show
  1. m-ailabs_speech_dataset_fr.py +19 -16
m-ailabs_speech_dataset_fr.py CHANGED
@@ -73,19 +73,22 @@ class MAILABSSpeechDataset(datasets.GeneratorBasedBuilder):
73
 
74
  def _generate_examples(self, datapath):
75
  key = 0
76
- try :
77
- for gender in ["male", "female", "mix"]:
78
- for name in os.listdir(os.path.join(datapath, "fr_FR", gender)):
79
- for book in os.listdir(os.path.join(datapath, "fr_FR", gender, name)):
80
- with open(os.path.join(datapath, "fr_FR", gender, name, book, "metadata.csv"), encoding="utf-8") as meta:
81
- for line in meta.readlines():
82
- line = line.split("|")
83
- filename = f"{line[0]}.wav"
84
- local_path = os.path.join("fr_FR", gender, name, book, "wavs", filename)
85
- yield key, {
86
- "sentence": line[1],
87
- "audio": os.path.join(datapath, local_path)
88
- }
89
- key += 1
90
- except:
91
- pass
 
 
 
 
73
 
74
  def _generate_examples(self, datapath):
75
  key = 0
76
+ for gender in ["male", "female", "mix"]:
77
+ for name in os.listdir(os.path.join(datapath, "fr_FR", gender)):
78
+ try :
79
+ for book in os.listdir(os.path.join(datapath, "fr_FR", gender, name)):
80
+ try:
81
+ with open(os.path.join(datapath, "fr_FR", gender, name, book, "metadata.csv"), encoding="utf-8") as meta:
82
+ for line in meta.readlines():
83
+ line = line.split("|")
84
+ filename = f"{line[0]}.wav"
85
+ local_path = os.path.join("fr_FR", gender, name, book, "wavs", filename)
86
+ yield key, {
87
+ "sentence": line[1],
88
+ "audio": os.path.join(datapath, local_path)
89
+ }
90
+ key +=1
91
+ except:
92
+ pass
93
+ except:
94
+ pass