nihalbaig commited on
Commit
38f7c29
1 Parent(s): b49781f

uploading code

Browse files
Files changed (2) hide show
  1. .gitattributes +1 -0
  2. bn_emotion_speech_corpus.py +73 -0
.gitattributes CHANGED
@@ -52,3 +52,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
52
  *.jpg filter=lfs diff=lfs merge=lfs -text
53
  *.jpeg filter=lfs diff=lfs merge=lfs -text
54
  *.webp filter=lfs diff=lfs merge=lfs -text
 
 
52
  *.jpg filter=lfs diff=lfs merge=lfs -text
53
  *.jpeg filter=lfs diff=lfs merge=lfs -text
54
  *.webp filter=lfs diff=lfs merge=lfs -text
55
+ subesco.tar.gz filter=lfs diff=lfs merge=lfs -text
bn_emotion_speech_corpus.py ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import datasets
2
+
3
+ _CITATION = """\
4
+ @dataset{sadia_sultana_2021_4526477,
5
+ author = {Sadia Sultana},
6
+ title = {SUST Bangla Emotional Speech Corpus (SUBESCO)},
7
+ month = feb,
8
+ year = 2021,
9
+ note = {{This database was created as a part of PhD thesis
10
+ project of the author Sadia Sultana. It was
11
+ designed and developed by the author in the
12
+ Department of Computer Science and Engineering of
13
+ Shahjalal University of Science and Technology.
14
+ Financial grant was supported by the university.
15
+ If you use the dataset please cite SUBESCO and the
16
+ corresponding academic journal publication in Plos
17
+ One.}},
18
+ publisher = {Zenodo},
19
+ version = {version - 1.1},
20
+ doi = {10.5281/zenodo.4526477},
21
+ url = {https://doi.org/10.5281/zenodo.4526477}
22
+ }
23
+ """
24
+
25
+ _DESCRIPTION = """\
26
+ SUST Bangla Emotional Speech Coropus Dataset
27
+ """
28
+ _HOMEPAGE = "https://huggingface.co/datasets/sustcsenlp/SUBESCO"
29
+
30
+ _LICENSE = ""
31
+
32
+ #_REPO = "https://huggingface.co/datasets/sustcsenlp/SUBESCO/resolve/main/corpus/speech/subesco.tar.gz"
33
+
34
+ class AudioSet(datasets.GeneratorBasedBuilder):
35
+ """"""
36
+
37
+ def _info(self):
38
+ return datasets.DatasetInfo(
39
+ description=_DESCRIPTION,
40
+ features=datasets.Features(
41
+ {
42
+ 'text': datasets.Value("string"),
43
+ "audio": datasets.Audio(sampling_rate=16000),
44
+ }
45
+ ),
46
+ supervised_keys=None,
47
+ homepage=_HOMEPAGE,
48
+ citation=_CITATION,
49
+ )
50
+
51
+ def _split_generators(self, dl_manager):
52
+ audio_archive = dl_manager.download("https://huggingface.co/datasets/sustcsenlp/bn_emotion_speech_corpus/resolve/main/subesco.tar.gz")
53
+ audio_iters = dl_manager.iter_archive(audio_archive)
54
+ return [
55
+ datasets.SplitGenerator(
56
+ name=datasets.Split.TRAIN,
57
+ gen_kwargs={
58
+ "audios": audio_iters
59
+ }
60
+ ),
61
+ ]
62
+
63
+ def _generate_examples(self, audios):
64
+ """This function returns the examples in the raw (text) form."""
65
+ idx = 0
66
+ for filepath, audio in audios:
67
+ description = filepath.split('/')[-1][:-4]
68
+ description = description.replace('_', ' ')
69
+ yield idx, {
70
+ "audio": {"path": filepath, "bytes": audio.read()},
71
+ "text": description,
72
+ }
73
+ idx += 1