sulaimank commited on
Commit
141b88a
·
verified ·
1 Parent(s): 0d02ec3

Delete swahili_test_samples.py

Browse files
Files changed (1) hide show
  1. swahili_test_samples.py +0 -66
swahili_test_samples.py DELETED
@@ -1,66 +0,0 @@
1
- import os
2
- import csv
3
- import datasets
4
-
5
- _CITATION = """\
6
- Add any citation or reference here.
7
- """
8
-
9
- _DESCRIPTION = """\
10
- Swahili test samples dataset with audio, predicted text, and reference text.
11
- """
12
-
13
-
14
- class SwahiliTestSamplesConfig(datasets.BuilderConfig):
15
- """BuilderConfig for SwahiliTestSamples."""
16
-
17
-
18
- class SwahiliTestSamples(datasets.GeneratorBasedBuilder):
19
- BUILDER_CONFIGS = [
20
- SwahiliTestSamplesConfig(
21
- name="default",
22
- version=datasets.Version("1.0.0"),
23
- description="Swahili test samples default config",
24
- ),
25
- ]
26
-
27
- def _info(self):
28
- return datasets.DatasetInfo(
29
- description=_DESCRIPTION,
30
- features=datasets.Features(
31
- {
32
- "audio": datasets.Audio(sampling_rate=None),
33
- "predicted_text": datasets.Value("string"),
34
- "reference_text": datasets.Value("string"),
35
- "expert_comment": datasets.Value("string"),
36
- }
37
- ),
38
- citation=_CITATION,
39
- )
40
-
41
- def _split_generators(self, dl_manager):
42
- """Download or retrieve data; in this case, we assume it's local."""
43
- # "data_dir" is the local path of the dataset repo. Inside it, we expect
44
- # `metadata.csv` and the `audios/` folder.
45
- csv_path = os.path.join(self.config.data_dir, "metadata.csv")
46
- return [
47
- datasets.SplitGenerator(
48
- name=datasets.Split.TRAIN,
49
- gen_kwargs={
50
- "csv_path": csv_path,
51
- },
52
- ),
53
- ]
54
-
55
- def _generate_examples(self, csv_path):
56
- """Yields examples from metadata.csv."""
57
- with open(csv_path, mode="r", encoding="utf-8") as f:
58
- reader = csv.DictReader(f)
59
- for i, row in enumerate(reader):
60
- yield i, {
61
- # The "audio" column is what `datasets.Audio` will use.
62
- "audio": row["path"], # e.g. 'audios/SWH-15-20101115_16k-…wav'
63
- "predicted_text": row["Predicted Text"],
64
- "reference_text": row["Reference Text"],
65
- "expert_comment": row.get("Expert's Comment", ""),
66
- }