Denhotech commited on
Commit
32b2c50
·
verified ·
1 Parent(s): cbfacba

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +10 -0
  2. audio/segment_000.wav +3 -0
  3. dataset_info.py +44 -0
  4. mapping.txt +1 -0
README.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ # Audio-Text Dataset
2
+
3
+ This dataset contains 1 audio segments with their corresponding text.
4
+
5
+ ## Format
6
+ - **audio**: Audio files in WAV format
7
+ - **text**: Corresponding text transcription
8
+
9
+ ## Created on
10
+ 2025-05-16 15:54:45
audio/segment_000.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f32fe8e5b5b4d9ea5cbf74bacba2d6d4966685c95da8a65a9ea410a6416ad653
3
+ size 8150444
dataset_info.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import os
3
+ import datasets
4
+
5
+ class AudioTextDataset(datasets.GeneratorBasedBuilder):
6
+ VERSION = datasets.Version("1.0.0")
7
+
8
+ def _info(self):
9
+ return datasets.DatasetInfo(
10
+ features=datasets.Features({
11
+ "audio": datasets.Audio(sampling_rate=22050),
12
+ "text": datasets.Value("string")
13
+ })
14
+ )
15
+
16
+ def _split_generators(self, dl_manager):
17
+ return [
18
+ datasets.SplitGenerator(
19
+ name=datasets.Split.TRAIN,
20
+ gen_kwargs={"split": "train"}
21
+ )
22
+ ]
23
+
24
+ def _generate_examples(self, split):
25
+ audio_dir = os.path.join(os.path.dirname(__file__), "audio")
26
+ audio_files = sorted([f for f in os.listdir(audio_dir) if f.endswith(".wav")])
27
+
28
+ # Load the mapping of audio files to text
29
+ text_mapping = {}
30
+ mapping_path = os.path.join(os.path.dirname(__file__), "mapping.txt")
31
+ with open(mapping_path, "r", encoding="utf-8") as f:
32
+ for line in f:
33
+ parts = line.strip().split("\t")
34
+ if len(parts) == 2:
35
+ audio_file, text = parts
36
+ text_mapping[audio_file] = text
37
+
38
+ for idx, audio_file in enumerate(audio_files):
39
+ if audio_file in text_mapping:
40
+ yield idx, {
41
+ "audio": os.path.join(audio_dir, audio_file),
42
+ "text": text_mapping[audio_file]
43
+ }
44
+
mapping.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ segment_000.wav\t2Ū Abulahamu walī ise wa ng'wa Isaka, Isaka ūmyala Yakobo, Yakobo ūmyala Yuda na baana ba ng'wawe.\n