tobiolatunji
commited on
Commit
·
48be34f
1
Parent(s):
db5d2e3
add audio_id field
Browse files- README.md +17 -7
- afrispeech-200.py +2 -1
README.md
CHANGED
@@ -160,15 +160,25 @@ English (Accented)
|
|
160 |
|
161 |
### Data Instances
|
162 |
|
163 |
-
A typical data point comprises the path to the audio file, called `path` and its transcription, called `
|
164 |
|
165 |
```
|
166 |
-
{
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
```
|
173 |
|
174 |
|
|
|
160 |
|
161 |
### Data Instances
|
162 |
|
163 |
+
A typical data point comprises the path to the audio file, called `path` and its transcription, called `transcript`. Some additional information about the speaker is provided.
|
164 |
|
165 |
```
|
166 |
+
{
|
167 |
+
'speaker_id': 'b545a4ca235a7b72688a1c0b3eb6bde6',
|
168 |
+
'path': 'aad9bd69-7ca0-4db1-b650-1eeea17a0153/5dcb6ee086e392376cd3b7131a250397.wav',
|
169 |
+
'audio_id': 'aad9bd69-7ca0-4db1-b650-1eeea17a0153/5dcb6ee086e392376cd3b7131a250397',
|
170 |
+
'audio': {
|
171 |
+
'path': 'aad9bd69-7ca0-4db1-b650-1eeea17a0153/5dcb6ee086e392376cd3b7131a250397.wav',
|
172 |
+
'array': array([0.00018311, 0.00061035, 0.00012207, ..., 0.00192261, 0.00195312, 0.00216675]),
|
173 |
+
'sampling_rate': 44100},
|
174 |
+
'transcript': 'His mother is in her 50 s and has hypertension .',
|
175 |
+
'age_group': '26-40',
|
176 |
+
'gender': 'Male',
|
177 |
+
'accent': 'yoruba',
|
178 |
+
'domain': 'clinical',
|
179 |
+
'country': 'US',
|
180 |
+
'duration': 3.241995464852608
|
181 |
+
}
|
182 |
```
|
183 |
|
184 |
|
afrispeech-200.py
CHANGED
@@ -112,6 +112,7 @@ class AfriSpeech(datasets.GeneratorBasedBuilder):
|
|
112 |
{
|
113 |
"speaker_id": datasets.Value("string"),
|
114 |
"path": datasets.Value("string"),
|
|
|
115 |
"audio": datasets.features.Audio(sampling_rate=44_100),
|
116 |
"transcript": datasets.Value("string"),
|
117 |
"age_group": datasets.Value("string"),
|
@@ -192,7 +193,6 @@ class AfriSpeech(datasets.GeneratorBasedBuilder):
|
|
192 |
|
193 |
data_fields = [key for key in self._info().features.keys() if key not in ["audio", "path"]]
|
194 |
metadata = {}
|
195 |
-
print("config:", self.config.name)
|
196 |
with open(meta_path, "r", encoding="utf-8") as f:
|
197 |
reader = csv.DictReader(f)
|
198 |
for row in tqdm(reader, desc="Reading metadata..."):
|
@@ -212,6 +212,7 @@ class AfriSpeech(datasets.GeneratorBasedBuilder):
|
|
212 |
# set the audio feature and the path to the extracted file
|
213 |
path = os.path.join(local_extracted_archive_paths[i], filename) if local_extracted_archive_paths else filename
|
214 |
result["audio"] = {"path": path, "bytes": file.read()}
|
|
|
215 |
# set path to None if the audio file doesn't exist locally (i.e. in streaming mode)
|
216 |
result["path"] = path if local_extracted_archive_paths else filename
|
217 |
|
|
|
112 |
{
|
113 |
"speaker_id": datasets.Value("string"),
|
114 |
"path": datasets.Value("string"),
|
115 |
+
"audio_id": datasets.Value("string"),
|
116 |
"audio": datasets.features.Audio(sampling_rate=44_100),
|
117 |
"transcript": datasets.Value("string"),
|
118 |
"age_group": datasets.Value("string"),
|
|
|
193 |
|
194 |
data_fields = [key for key in self._info().features.keys() if key not in ["audio", "path"]]
|
195 |
metadata = {}
|
|
|
196 |
with open(meta_path, "r", encoding="utf-8") as f:
|
197 |
reader = csv.DictReader(f)
|
198 |
for row in tqdm(reader, desc="Reading metadata..."):
|
|
|
212 |
# set the audio feature and the path to the extracted file
|
213 |
path = os.path.join(local_extracted_archive_paths[i], filename) if local_extracted_archive_paths else filename
|
214 |
result["audio"] = {"path": path, "bytes": file.read()}
|
215 |
+
result["audio_id"] = filename.replace(".wav", "")
|
216 |
# set path to None if the audio file doesn't exist locally (i.e. in streaming mode)
|
217 |
result["path"] = path if local_extracted_archive_paths else filename
|
218 |
|