parameters: (self, desc_file, partition='train',
                                       max_duration=16.0,)
docstring: Read metadata from the description file
              (possibly takes long, depending on the filesize)
          Params:
              desc_file (str):  Path to a JSON-line file that contains labels and
                  paths to the audio files
              partition (str): One of 'train', 'validation' or 'test'
              max_duration (float): In seconds, the maximum duration of
                  utterances to train or test on
docstring_summary: Read metadata from the description file
              (possibly takes long, depending on the filesize)
          Params:
              desc_file (str):  Path to a JSON-line file that contains labels and
                  paths to the audio files
              partition (str): One of 'train', 'validation' or 'test'
              max_duration (float): In seconds, the maximum duration of
                  utterances to train or test on
docstring_tokens: Read metadata from the description file ( possibly takes long depending on the filesize ) Params : desc_file ( str ) : Path to a JSON - line file that contains labels and paths to the audio files partition ( str ) : One of train validation or test max_duration ( float ) : In seconds the maximum duration of utterances to train or test on
function: def load_metadata_from_desc_file(self, desc_file, partition='train',
                                       max_duration=16.0,):
          """ Read metadata from the description file
              (possibly takes long, depending on the filesize)
          Params:
              desc_file (str):  Path to a JSON-line file that contains labels and
                  paths to the audio files
              partition (str): One of 'train', 'validation' or 'test'
              max_duration (float): In seconds, the maximum duration of
                  utterances to train or test on
          """
          logger = logUtil.getlogger()
          logger.info('Reading description file: {} for partition: {}'
                      .format(desc_file, partition))
          audio_paths, durations, texts = [], [], []
          with open(desc_file) as json_line_file:
              for line_num, json_line in enumerate(json_line_file):
                  try:
                      spec = json.loads(json_line)
                      if float(spec['duration']) > max_duration:
                          continue
                      audio_paths.append(spec['key'])
                      durations.append(float(spec['duration']))
                      texts.append(spec['text'])
                  except Exception as e:
                      # Change to (KeyError, ValueError) or
                      # (KeyError,json.decoder.JSONDecodeError), depending on
                      # json module version
                      logger.warn('Error reading line #{}: {}'
                                  .format(line_num, json_line))
                      logger.warn(str(e))
  
          if partition == 'train':
              self.count = len(audio_paths)
              self.train_audio_paths = audio_paths
              self.train_durations = durations
              self.train_texts = texts
          elif partition == 'validation':
              self.val_audio_paths = audio_paths
              self.val_durations = durations
              self.val_texts = texts
              self.val_count = len(audio_paths)
          elif partition == 'test':
              self.test_audio_paths = audio_paths
              self.test_durations = durations
              self.test_texts = texts
          else:
              raise Exception("Invalid partition to load metadata. "
                              "Must be train/validation/test")
function_tokens: def load_metadata_from_desc_file ( self , desc_file , partition = 'train' , max_duration = 16.0 , ) : logger = logUtil . getlogger ( ) logger . info ( 'Reading description file: {} for partition: {}' . format ( desc_file , partition ) ) audio_paths , durations , texts = [ ] , [ ] , [ ] with open ( desc_file ) as json_line_file : for line_num , json_line in enumerate ( json_line_file ) : try : spec = json . loads ( json_line ) if float ( spec [ 'duration' ] ) > max_duration : continue audio_paths . append ( spec [ 'key' ] ) durations . append ( float ( spec [ 'duration' ] ) ) texts . append ( spec [ 'text' ] ) except Exception as e : # Change to (KeyError, ValueError) or # (KeyError,json.decoder.JSONDecodeError), depending on # json module version logger . warn ( 'Error reading line #{}: {}' . format ( line_num , json_line ) ) logger . warn ( str ( e ) ) if partition == 'train' : self . count = len ( audio_paths ) self . train_audio_paths = audio_paths self . train_durations = durations self . train_texts = texts elif partition == 'validation' : self . val_audio_paths = audio_paths self . val_durations = durations self . val_texts = texts self . val_count = len ( audio_paths ) elif partition == 'test' : self . test_audio_paths = audio_paths self . test_durations = durations self . test_texts = texts else : raise Exception ( "Invalid partition to load metadata. " "Must be train/validation/test" )