MCPcopy Create free account
hub / github.com/allenai/OLMoASR / SwitchBoardLoader

Class SwitchBoardLoader

scripts/eval/eval.py:719–803  ·  view source on GitHub ↗

Dataset loader for Switchboard corpus. Switchboard contains conversational telephone speech between strangers discussing predetermined topics. Like CallHome, it uses the HUB5 evaluation format but represents more structured conversational speech. Dataset Structure: - HUB5 S

Source from the content-addressed store, hash-verified

717
718
719class SwitchBoardLoader(BaseDatasetLoader):
720 """Dataset loader for Switchboard corpus.
721
722 Switchboard contains conversational telephone speech between strangers discussing
723 predetermined topics. Like CallHome, it uses the HUB5 evaluation format but
724 represents more structured conversational speech.
725
726 Dataset Structure:
727 - HUB5 STM format with timing and channel information
728 - SPHERE audio files requiring channel extraction
729 - Topic-guided conversational speech
730
731 Returns:
732 Tuple of AudioSegment objects with timing and corresponding transcript texts
733
734 Reference:
735 Godfrey, J. J., et al. "SWITCHBOARD: telephone speech corpus for research and development."
736 """
737
738 def load(self) -> Tuple[list, list]:
739 """Load Switchboard audio segments and transcripts.
740
741 Delegates to the shared HUB5 data loading logic with Switchboard prefix
742 to extract Switchboard-specific segments.
743
744 Returns:
745 Tuple[list, list]: A tuple containing:
746 - List of AudioSegment tuples (wav_file, start_time, end_time)
747 - List of corresponding transcript strings
748 """
749 return self._load_hub5_data("sw")
750
751 def _load_hub5_data(self, prefix: str) -> Tuple[list, list]:
752 """Common logic for CallHome and SwitchBoard datasets.
753
754 Parses HUB5 STM format files to extract audio segments with precise timing
755 information. Handles channel separation using Sox audio processing.
756
757 Args:
758 prefix (str): Dataset prefix ("en" for CallHome, "sw" for Switchboard)
759
760 Returns:
761 Tuple[list, list]: A tuple containing:
762 - List of AudioSegment tuples (wav_file, start_time, end_time)
763 - List of corresponding transcript strings
764
765 Note:
766 Requires Sox audio processing tool for SPHERE format conversion
767 and channel extraction.
768 """
769 audio_files, transcript_files = [], []
770
771 stm_path = f"{self.root_dir}/2000_hub5_eng_eval_tr/reference/hub5e00.english.000405.stm"
772 with open(stm_path, "r") as f:
773 for line in f:
774 if line.startswith(";;") or not line.startswith(prefix):
775 continue
776

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected