phongdtd
commited on
Commit
·
6b640f7
1
Parent(s):
a873fa7
Update description
Browse files- youtube_casual_audio.py +10 -12
youtube_casual_audio.py
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
# See the License for the specific language governing permissions and
|
14 |
# limitations under the License.
|
15 |
-
"""
|
16 |
|
17 |
|
18 |
import datasets
|
@@ -37,15 +37,15 @@ _LANGUAGES = {
|
|
37 |
"Date": "2021-12-11",
|
38 |
"Size": "17000 MB",
|
39 |
"Version": "vi_100h_2020-12-11",
|
40 |
-
"Validated_Hr_Total":
|
41 |
-
"Overall_Hr_Total":
|
42 |
"Number_Of_Voice": 62,
|
43 |
},
|
44 |
}
|
45 |
|
46 |
|
47 |
-
class
|
48 |
-
"""BuilderConfig for
|
49 |
|
50 |
def __init__(self, name, sub_version, **kwargs):
|
51 |
"""
|
@@ -63,20 +63,20 @@ class CustomCommonVoiceConfig(datasets.BuilderConfig):
|
|
63 |
self.validated_hr_total = kwargs.pop("val_hrs", None)
|
64 |
self.total_hr_total = kwargs.pop("total_hrs", None)
|
65 |
self.num_of_voice = kwargs.pop("num_of_voice", None)
|
66 |
-
description = f"
|
67 |
f"{self.sub_version} of {self.date_of_snapshot}. " \
|
68 |
f"The dataset comprises {self.validated_hr_total} of validated transcribed speech data from " \
|
69 |
f"{self.num_of_voice} speakers. The dataset has a size of {self.size} "
|
70 |
-
super(
|
71 |
name=name, version=datasets.Version("0.1.0", ""), description=description, **kwargs
|
72 |
)
|
73 |
|
74 |
|
75 |
-
class
|
76 |
|
77 |
DEFAULT_WRITER_BATCH_SIZE = 1000
|
78 |
BUILDER_CONFIGS = [
|
79 |
-
|
80 |
name=lang_id,
|
81 |
language=_LANGUAGES[lang_id]["Language"],
|
82 |
sub_version=_LANGUAGES[lang_id]["Version"],
|
@@ -89,7 +89,6 @@ class CustomCommonVoice(datasets.GeneratorBasedBuilder):
|
|
89 |
{
|
90 |
"file_path": datasets.Value("string"),
|
91 |
"script": datasets.Value("string"),
|
92 |
-
"duration": datasets.Value("float32"),
|
93 |
"audio": datasets.Audio(sampling_rate=16_000),
|
94 |
}
|
95 |
)
|
@@ -148,7 +147,7 @@ class CustomCommonVoice(datasets.GeneratorBasedBuilder):
|
|
148 |
df = df.dropna()
|
149 |
chars_to_ignore_regex = r'[,?.!\-;:"“%\'�]'
|
150 |
|
151 |
-
for file_path, script
|
152 |
# set full path for mp3 audio file
|
153 |
audio_path = path_to_clips + "/" + file_path
|
154 |
|
@@ -162,7 +161,6 @@ class CustomCommonVoice(datasets.GeneratorBasedBuilder):
|
|
162 |
examples[audio_path] = {
|
163 |
"file_path": audio_path,
|
164 |
"script": script,
|
165 |
-
"duration": duration
|
166 |
}
|
167 |
|
168 |
for path, f in audio_files:
|
|
|
12 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
# See the License for the specific language governing permissions and
|
14 |
# limitations under the License.
|
15 |
+
""" Youtube Casual Audio Dataset"""
|
16 |
|
17 |
|
18 |
import datasets
|
|
|
37 |
"Date": "2021-12-11",
|
38 |
"Size": "17000 MB",
|
39 |
"Version": "vi_100h_2020-12-11",
|
40 |
+
"Validated_Hr_Total": '~20h',
|
41 |
+
"Overall_Hr_Total": '~100h',
|
42 |
"Number_Of_Voice": 62,
|
43 |
},
|
44 |
}
|
45 |
|
46 |
|
47 |
+
class YoutubeCasualAudioConfig(datasets.BuilderConfig):
|
48 |
+
"""BuilderConfig for YoutubeCasualAudio."""
|
49 |
|
50 |
def __init__(self, name, sub_version, **kwargs):
|
51 |
"""
|
|
|
63 |
self.validated_hr_total = kwargs.pop("val_hrs", None)
|
64 |
self.total_hr_total = kwargs.pop("total_hrs", None)
|
65 |
self.num_of_voice = kwargs.pop("num_of_voice", None)
|
66 |
+
description = f"Youtube Casual Audio speech to text dataset in {self.language} version " \
|
67 |
f"{self.sub_version} of {self.date_of_snapshot}. " \
|
68 |
f"The dataset comprises {self.validated_hr_total} of validated transcribed speech data from " \
|
69 |
f"{self.num_of_voice} speakers. The dataset has a size of {self.size} "
|
70 |
+
super(YoutubeCasualAudioConfig, self).__init__(
|
71 |
name=name, version=datasets.Version("0.1.0", ""), description=description, **kwargs
|
72 |
)
|
73 |
|
74 |
|
75 |
+
class YoutubeCasualAudio(datasets.GeneratorBasedBuilder):
|
76 |
|
77 |
DEFAULT_WRITER_BATCH_SIZE = 1000
|
78 |
BUILDER_CONFIGS = [
|
79 |
+
YoutubeCasualAudioConfig(
|
80 |
name=lang_id,
|
81 |
language=_LANGUAGES[lang_id]["Language"],
|
82 |
sub_version=_LANGUAGES[lang_id]["Version"],
|
|
|
89 |
{
|
90 |
"file_path": datasets.Value("string"),
|
91 |
"script": datasets.Value("string"),
|
|
|
92 |
"audio": datasets.Audio(sampling_rate=16_000),
|
93 |
}
|
94 |
)
|
|
|
147 |
df = df.dropna()
|
148 |
chars_to_ignore_regex = r'[,?.!\-;:"“%\'�]'
|
149 |
|
150 |
+
for file_path, script in zip(df["file_path"], df["script"]):
|
151 |
# set full path for mp3 audio file
|
152 |
audio_path = path_to_clips + "/" + file_path
|
153 |
|
|
|
161 |
examples[audio_path] = {
|
162 |
"file_path": audio_path,
|
163 |
"script": script,
|
|
|
164 |
}
|
165 |
|
166 |
for path, f in audio_files:
|