hashmin commited on
Commit
db8bd28
·
verified ·
1 Parent(s): c094837

Upload epadb.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. epadb.py +67 -0
epadb.py ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import datasets
3
+
4
+ _CITATION = """\
5
+ @article{vidal2019epadb,
6
+ title={EpaDB: a database for development of pronunciation assessment systems},
7
+ author={Vidal, Jazmin and Ferrer, Luciana and Brambilla, Leonardo},
8
+ journal={Proc. Interspeech},
9
+ pages={589--593},
10
+ year={2019}
11
+ }
12
+ """
13
+
14
+ _DESCRIPTION = """\
15
+ EPADB contains curated pronunciation assessment data collected from Spanish-speaking learners of English.
16
+ """
17
+
18
+ class Epadb(datasets.GeneratorBasedBuilder):
19
+ """EPADB dataset."""
20
+
21
+ def _info(self):
22
+ return datasets.DatasetInfo(
23
+ description=_DESCRIPTION,
24
+ features=datasets.Features({
25
+ "utt_id": datasets.Value("string"),
26
+ "speaker_id": datasets.Value("string"),
27
+ "sentence_id": datasets.Value("string"),
28
+ "phone_ids": datasets.Sequence(datasets.Value("string")),
29
+ "ref_phonemic_1": datasets.Sequence(datasets.Value("string")),
30
+ "annot_1": datasets.Sequence(datasets.Value("string")),
31
+ "lab_phonemic_1": datasets.Sequence(datasets.Value("string")),
32
+ "error_type": datasets.Sequence(datasets.Value("string")),
33
+ "start_mfa": datasets.Sequence(datasets.Value("float")),
34
+ "end_mfa": datasets.Sequence(datasets.Value("float")),
35
+ "global_1": datasets.Value("float"),
36
+ "level_1": datasets.Value("string"),
37
+ "gender": datasets.Value("string"),
38
+ "duration": datasets.Value("float"),
39
+ "sample_rate": datasets.Value("int32"),
40
+ "audio": datasets.Audio(sampling_rate=16000),
41
+ "transcription": datasets.Value("string"),
42
+ }),
43
+ citation=_CITATION,
44
+ )
45
+
46
+ def _split_generators(self, dl_manager):
47
+ train_path = dl_manager.download("train.json")
48
+ test_path = dl_manager.download("test.json")
49
+
50
+ return [
51
+ datasets.SplitGenerator(
52
+ name=datasets.Split.TRAIN,
53
+ gen_kwargs={"filepath": train_path, "split": "train"},
54
+ ),
55
+ datasets.SplitGenerator(
56
+ name=datasets.Split.TEST,
57
+ gen_kwargs={"filepath": test_path, "split": "test"},
58
+ ),
59
+ ]
60
+
61
+ def _generate_examples(self, filepath, split):
62
+ with open(filepath, encoding="utf-8") as f:
63
+ data = json.load(f)
64
+ for idx, example in enumerate(data):
65
+ # The audio field contains the relative path
66
+ # datasets library will automatically download it
67
+ yield idx, example