def HTKMLFDeserializer(label_mapping_file, streams, phoneBoundaries=False): ''' Configures an HTK label reader that reads speech HTK format MLF (Master Label File) Args: label_mapping_file (str): path to the label mapping file streams: any dictionary-like object that contains a mapping from stream names to :class:`StreamDef` objects. Each StreamDef object configures a label stream. phoneBoundaries (bool): if phone boundaries should be considered (should be set to True for CTC training, False otherwise) ''' if len(streams) != 1: raise ValueError("HTKMLFDeserializer only accepts a single stream") for stream_name, stream in streams.items(): if stream.stream_alias is not None: raise ValueError( "HTKMLFDeserializer does not support stream names") dimension = stream.dim if 'mlf' not in stream: raise ValueError( "No master label files specified for HTKMLFDeserializer") master_label_files = stream['mlf'] if not isinstance(master_label_files, list): master_label_files = [master_label_files] return cntk_py.htk_mlf_deserializer(stream_name, label_mapping_file, dimension, master_label_files, phoneBoundaries)
def HTKMLFDeserializer(label_mapping_file, streams, phoneBoundaries = False): ''' Configures an HTK label reader that reads speech HTK format MLF (Master Label File) Args: label_mapping_file (str): path to the label mapping file streams: any dictionary-like object that contains a mapping from stream names to :class:`StreamDef` objects. Each StreamDef object configures a label stream. phoneBoundaries (bool): if phone boundaries should be considered (should be set to True for CTC training, False otherwise) ''' if len(streams) != 1: raise ValueError("HTKMLFDeserializer only accepts a single stream") for stream_name, stream in streams.items(): if stream.stream_alias is not None: raise ValueError("HTKMLFDeserializer does not support stream names") dimension = stream.dim if 'mlf' not in stream: raise ValueError( "No master label files specified for HTKMLFDeserializer") master_label_files = stream['mlf'] if not isinstance(master_label_files, list): master_label_files = [master_label_files] return cntk_py.htk_mlf_deserializer(stream_name, label_mapping_file, dimension, master_label_files, phoneBoundaries)