birgermoell
commited on
Commit
•
368c070
1
Parent(s):
939d303
Updated loading script
Browse files- speechdat.py +17 -7
speechdat.py
CHANGED
@@ -98,12 +98,22 @@ class SpeechDat(datasets.GeneratorBasedBuilder):
|
|
98 |
text_line = get_single_line(text_file)
|
99 |
if text_line is None or text_line == "":
|
100 |
continue
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
"audio": {
|
106 |
"path": str(wav_file),
|
107 |
-
"
|
|
|
|
|
|
|
|
|
108 |
}
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
text_line = get_single_line(text_file)
|
99 |
if text_line is None or text_line == "":
|
100 |
continue
|
101 |
+
size = os.path.getsize(wav_file)
|
102 |
+
if size > 1024:
|
103 |
+
with open(wav_file, "rb") as wav_data:
|
104 |
+
yield str(wav_file), {
|
|
|
105 |
"path": str(wav_file),
|
106 |
+
"sentence": text_line,
|
107 |
+
"audio": {
|
108 |
+
"path": str(wav_file),
|
109 |
+
"bytes": wav_data.read()
|
110 |
+
}
|
111 |
}
|
112 |
+
|
113 |
+
|
114 |
+
|
115 |
+
def normalize(text):
|
116 |
+
# remove ~
|
117 |
+
|
118 |
+
|
119 |
+
return text
|