File size: 2,505 Bytes
38f7c29
 
 
4c410ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38f7c29
 
 
4c410ca
 
38f7c29
4c410ca
de7841d
9877bb1
38f7c29
de7841d
4c410ca
9877bb1
38f7c29
 
 
 
9877bb1
 
 
 
 
 
38f7c29
 
 
 
 
 
7a91e29
9877bb1
38f7c29
 
 
 
9877bb1
 
 
38f7c29
9877bb1
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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]
            #description = description.replace('_', ' ')
            yield idx, {
                "audio": {"path": filepath, "bytes": audio.read()},
                "text": description,
            }
            idx += 1