Update m-ailabs_speech_dataset_fr.py
Browse files- 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 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
|
|
|
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
|