mj-new commited on
Commit
70c57c1
1 Parent(s): d83bc5f

Updated README and build script with speech rates and utts lenghts

Browse files
Files changed (3) hide show
  1. README.md +6 -1
  2. pl-asr-bigos-v2.py +19 -4
  3. test.py +0 -1
README.md CHANGED
@@ -119,8 +119,13 @@ Available fields:
119
  * `audio_duration_seconds` - duration of recordings in seconds
120
  * `audiopath_bigos` - relative filepath to audio file extracted from tar.gz archive
121
  * `audiopath_local` - absolute filepath to audio file extracted with the build script
122
- * `speaker_sex` - sex of the speaker extracted from the source meta-data (N/A if not available)
123
  * `speaker_age` - age group of the speaker (in CommonVoice format) extracted from the source (N/A if not available)
 
 
 
 
 
124
  <br><br>
125
 
126
  ### Data Splits
 
119
  * `audio_duration_seconds` - duration of recordings in seconds
120
  * `audiopath_bigos` - relative filepath to audio file extracted from tar.gz archive
121
  * `audiopath_local` - absolute filepath to audio file extracted with the build script
122
+ * `speaker_gender` - gender (sex) of the speaker extracted from the source meta-data (N/A if not available)
123
  * `speaker_age` - age group of the speaker (in CommonVoice format) extracted from the source (N/A if not available)
124
+ * `utt_length_words` - length of the utterance in words
125
+ * `utt_length_chars` - length of the utterance in characters
126
+ * `speech_rate_words` - speech rate - average number of words per second
127
+ * `speech_rate_chars` - speech rage - average number of characters per second
128
+
129
  <br><br>
130
 
131
  ### Data Splits
pl-asr-bigos-v2.py CHANGED
@@ -112,7 +112,11 @@ class Bigos(datasets.GeneratorBasedBuilder):
112
  "audiopath_bigos": datasets.Value("string"),
113
  "audiopath_local": datasets.Value("string"),
114
  "speaker_age": datasets.Value("string"),
115
- "speaker_sex": datasets.Value("string")
 
 
 
 
116
  }
117
  )
118
 
@@ -183,7 +187,7 @@ class Bigos(datasets.GeneratorBasedBuilder):
183
  sampling_rate,
184
  ref_orig,
185
  audio_path_bigos,
186
- sex,
187
  age
188
 
189
  ) = line.strip().split("\t")
@@ -199,7 +203,7 @@ class Bigos(datasets.GeneratorBasedBuilder):
199
  "ref_orig": str.strip(ref_orig),
200
  "audiopath_bigos": str.strip(audio_path_bigos),
201
  "speaker_age": str.strip(age),
202
- "speaker_sex": str.strip(sex)
203
  }
204
 
205
  return data
@@ -228,7 +232,6 @@ class Bigos(datasets.GeneratorBasedBuilder):
228
 
229
  #print("audio_filename: ", audio_filename)
230
  result = data[audio_filename]
231
- #print("result: ", result)
232
  extracted_audio_path = (
233
  os.path.join(local_extracted_path, audio_filename)
234
  if local_extracted_path is not None
@@ -240,5 +243,17 @@ class Bigos(datasets.GeneratorBasedBuilder):
240
  # dividing the byte length by 2 because the audio is 16-bit PCM. Removing the header
241
  result["audio_duration_samples"] = len(result["audio"]["bytes"]) // 2 - 22
242
  result["audio_duration_seconds"] = round(int(result["audio_duration_samples"]) / int(result["sampling_rate"]), 2)
 
 
 
 
 
 
 
 
 
 
 
 
243
  yield key, result
244
  key += 1
 
112
  "audiopath_bigos": datasets.Value("string"),
113
  "audiopath_local": datasets.Value("string"),
114
  "speaker_age": datasets.Value("string"),
115
+ "speaker_gender": datasets.Value("string"),
116
+ "utt_length_words": datasets.Value("int32"),
117
+ "utt_length_chars": datasets.Value("int32"),
118
+ "speech_rate_words": datasets.Value("float32"),
119
+ "speech_rate_chars": datasets.Value("float32")
120
  }
121
  )
122
 
 
187
  sampling_rate,
188
  ref_orig,
189
  audio_path_bigos,
190
+ gender,
191
  age
192
 
193
  ) = line.strip().split("\t")
 
203
  "ref_orig": str.strip(ref_orig),
204
  "audiopath_bigos": str.strip(audio_path_bigos),
205
  "speaker_age": str.strip(age),
206
+ "speaker_gender": str.strip(gender)
207
  }
208
 
209
  return data
 
232
 
233
  #print("audio_filename: ", audio_filename)
234
  result = data[audio_filename]
 
235
  extracted_audio_path = (
236
  os.path.join(local_extracted_path, audio_filename)
237
  if local_extracted_path is not None
 
243
  # dividing the byte length by 2 because the audio is 16-bit PCM. Removing the header
244
  result["audio_duration_samples"] = len(result["audio"]["bytes"]) // 2 - 22
245
  result["audio_duration_seconds"] = round(int(result["audio_duration_samples"]) / int(result["sampling_rate"]), 2)
246
+
247
+ if result["ref_orig"] == "":
248
+ result["utt_length_words"] = None
249
+ result["utt_length_chars"] = None
250
+ result["speech_rate_words"] = None
251
+ result["speech_rate_chars"] = None
252
+ else:
253
+ result["utt_length_words"] = len(result["ref_orig"].split())
254
+ result["utt_length_chars"] = len(result["ref_orig"])
255
+ result["speech_rate_words"] = round(result["utt_length_words"] / result["audio_duration_seconds"], 2)
256
+ result["speech_rate_chars"] = round(result["utt_length_chars"] / result["audio_duration_seconds"], 2)
257
+
258
  yield key, result
259
  key += 1
test.py CHANGED
@@ -26,7 +26,6 @@ print(dataset_local["test"][0])
26
  print(dataset_local["validation"][0])
27
  print(dataset_local["train"][0])
28
  df_test = pd.DataFrame(dataset_local['test'])
29
- print(df_test['speaker_sex'].unique())
30
 
31
  print("Checking build script on huggingface.co")
32
  dataset_hf = load_dataset(hf_db_name, "all", download_mode="force_redownload")
 
26
  print(dataset_local["validation"][0])
27
  print(dataset_local["train"][0])
28
  df_test = pd.DataFrame(dataset_local['test'])
 
29
 
30
  print("Checking build script on huggingface.co")
31
  dataset_hf = load_dataset(hf_db_name, "all", download_mode="force_redownload")