(self, part_size)
Return next part of utts.
Return next part of utts.
Return next part of utts .
def next_part_utts(self, part_size):
    ''' Return next part of utts. '''
    if self.select_by_spk:
      # Select utterances by speaker.
      for index in range(part_size):
        try:
          spk = self.spk_keys.pop()
        except IndexError:
          break
        spk_utts = self.meta.spks[spk].utts
        if not spk_utts:
          # None (e.g. with external id mapping) or len == 0
          continue
        random_idx = random.randint(0, len(spk_utts) - 1)
        if random_idx < 0:
          # Not likely.
          continue
        utt_key = spk_utts[random_idx]
        utt_meta = self.meta.utts[utt_key]
        yield (utt_key, utt_meta)
    else:
      # Randomly selects utterances.
      for index in range(part_size):
        try:
          utt_key = self.utt_keys.pop()
        except IndexError:
          break
        utt_meta = self.meta.utts[utt_key]
        yield (utt_key, utt_meta)
def next_part_utts ( self , part_size ) : if self . select_by_spk : # Select utterances by speaker. for index in range ( part_size ) : try : spk = self . spk_keys . pop ( ) except IndexError : break spk_utts = self . meta . spks [ spk ] . utts if not spk_utts : # None (e.g. with external id mapping) or len == 0 continue random_idx = random . randint ( 0 , len ( spk_utts ) - 1 ) if random_idx < 0 : # Not likely. continue utt_key = spk_utts [ random_idx ] utt_meta = self . meta . utts [ utt_key ] yield ( utt_key , utt_meta ) else : # Randomly selects utterances. for index in range ( part_size ) : try : utt_key = self . utt_keys . pop ( ) except IndexError : break utt_meta = self . meta . utts [ utt_key ] yield ( utt_key , utt_meta )