|
import datasets |
|
|
|
_CITATION = """\ |
|
@dataset{sadia_sultana_2021_4526477, |
|
author = {Sadia Sultana}, |
|
title = {SUST Bangla Emotional Speech Corpus (SUBESCO)}, |
|
month = feb, |
|
year = 2021, |
|
note = {{This database was created as a part of PhD thesis |
|
project of the author Sadia Sultana. It was |
|
designed and developed by the author in the |
|
Department of Computer Science and Engineering of |
|
Shahjalal University of Science and Technology. |
|
Financial grant was supported by the university. |
|
If you use the dataset please cite SUBESCO and the |
|
corresponding academic journal publication in Plos |
|
One.}}, |
|
publisher = {Zenodo}, |
|
version = {version - 1.1}, |
|
doi = {10.5281/zenodo.4526477}, |
|
url = {https://doi.org/10.5281/zenodo.4526477} |
|
} |
|
""" |
|
|
|
_DESCRIPTION = """\ |
|
SUST Bangla Emotional Speech Coropus Dataset |
|
""" |
|
|
|
_HOMEPAGE = "https://huggingface.co/datasets/sustcsenlp/bn_emotion_speech_corpus" |
|
|
|
_LICENSE = "" |
|
|
|
|
|
class AudioSet(datasets.GeneratorBasedBuilder): |
|
"""""" |
|
|
|
def _info(self): |
|
return datasets.DatasetInfo( |
|
description=_DESCRIPTION, |
|
features=datasets.Features( |
|
{ |
|
'text': datasets.Value("string"), |
|
"audio": datasets.Audio(sampling_rate=16000), |
|
} |
|
), |
|
supervised_keys=None, |
|
homepage=_HOMEPAGE, |
|
citation=_CITATION, |
|
) |
|
|
|
def _split_generators(self, dl_manager): |
|
audio_archive = dl_manager.download("https://huggingface.co/datasets/sustcsenlp/bn_emotion_speech_corpus/resolve/main/subesco.tar.gz") |
|
audio_iters = dl_manager.iter_archive(audio_archive) |
|
return [ |
|
datasets.SplitGenerator( |
|
name=datasets.Split.TRAIN, |
|
gen_kwargs={ |
|
"audios": audio_iters |
|
} |
|
), |
|
] |
|
|
|
def _generate_examples(self, audios): |
|
"""This function returns the examples in the raw (text) form.""" |
|
idx = 0 |
|
for filepath, audio in audios: |
|
description = filepath.split('/')[-1][:-4] |
|
|
|
yield idx, { |
|
"audio": {"path": filepath, "bytes": audio.read()}, |
|
"text": description, |
|
} |
|
idx += 1 |