sanchit-gandhi
commited on
Commit
·
5460839
1
Parent(s):
d9c2d06
ami boom
Browse files- ami-ihm.py +8 -11
ami-ihm.py
CHANGED
@@ -19,7 +19,7 @@ the participants also have unsynchronized pens available to them that record wha
|
|
19 |
were recorded in English using three different rooms with different acoustic properties, and include mostly
|
20 |
non-native speakers.
|
21 |
"""
|
22 |
-
|
23 |
import os
|
24 |
|
25 |
import datasets
|
@@ -265,9 +265,9 @@ _AUDIO_ARCHIVE_URL = _BASE_DATA_URL + "audio/{subset}/{split}/{_id}.tar.gz"
|
|
265 |
|
266 |
_ANNOTATIONS_ARCHIVE_URL = _BASE_DATA_URL + "annotations/{split}/text"
|
267 |
|
268 |
-
_TRANSCRIPT_URL = "https://huggingface.co/datasets/distil-whisper/
|
269 |
|
270 |
-
_TRANSCRIPT_URLS = _TRANSCRIPT_URL + "
|
271 |
|
272 |
logger = datasets.utils.logging.get_logger(__name__)
|
273 |
|
@@ -409,13 +409,11 @@ class AMI(datasets.GeneratorBasedBuilder):
|
|
409 |
"speaker_id": speaker_id,
|
410 |
}
|
411 |
|
412 |
-
|
413 |
-
|
414 |
with open(transcript_files, encoding="utf-8") as f:
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
idx = 0
|
419 |
|
420 |
features = ["meeting_id", "id", "text", "begin_time", "end_time", "microphone_id", "speaker_id"]
|
421 |
for archive, local_archive_path in zip(audio_archives, local_extracted_archives_paths):
|
@@ -434,6 +432,5 @@ class AMI(datasets.GeneratorBasedBuilder):
|
|
434 |
"bytes": audio_file.read(),
|
435 |
},
|
436 |
**{feature: audio_meta[feature] for feature in features},
|
437 |
-
"whisper_transcript":
|
438 |
}
|
439 |
-
idx += 1
|
|
|
19 |
were recorded in English using three different rooms with different acoustic properties, and include mostly
|
20 |
non-native speakers.
|
21 |
"""
|
22 |
+
import csv
|
23 |
import os
|
24 |
|
25 |
import datasets
|
|
|
265 |
|
266 |
_ANNOTATIONS_ARCHIVE_URL = _BASE_DATA_URL + "annotations/{split}/text"
|
267 |
|
268 |
+
_TRANSCRIPT_URL = "https://huggingface.co/datasets/distil-whisper/whisper_transcriptions_greedy/resolve/main/ami-ihm/"
|
269 |
|
270 |
+
_TRANSCRIPT_URLS = _TRANSCRIPT_URL + "{split}-transcription.csv"
|
271 |
|
272 |
logger = datasets.utils.logging.get_logger(__name__)
|
273 |
|
|
|
409 |
"speaker_id": speaker_id,
|
410 |
}
|
411 |
|
412 |
+
whisper_transcriptions = dict()
|
|
|
413 |
with open(transcript_files, encoding="utf-8") as f:
|
414 |
+
reader = csv.DictReader(f, delimiter=",", quoting=csv.QUOTE_NONE)
|
415 |
+
for line in reader:
|
416 |
+
whisper_transcriptions[line["file_id"]] = line["whisper_transcript"]
|
|
|
417 |
|
418 |
features = ["meeting_id", "id", "text", "begin_time", "end_time", "microphone_id", "speaker_id"]
|
419 |
for archive, local_archive_path in zip(audio_archives, local_extracted_archives_paths):
|
|
|
432 |
"bytes": audio_file.read(),
|
433 |
},
|
434 |
**{feature: audio_meta[feature] for feature in features},
|
435 |
+
"whisper_transcript": whisper_transcriptions.get(audio_meta["id"], None)
|
436 |
}
|
|