class_docstr: Data preparation script for the Swiss French Polyphone corpus.
  
  This class provides the scripting backbone for preparing the
  Swiss French Polyphone corpus for ASR training with espnet.  This
  script was written in reference to the following version of the
  corpus as listed on ELRA:
  
  This class/script, together with the corresponding configuration
  file `conf/dataprep.yaml` perform all required data prep.
  
  .. _ELRA-S0030_02:
      http://catalog.elra.info/en-us/repository/browse/ELRA-S0030_02
class_docstr_tok: ["Data","preparation","script","for","the","Swiss","French","Polyphone","corpus",".","This","class","provides","the","scripting","backbone","for","preparing","the","Swiss","French","Polyphone","corpus","for","ASR","training","with","espnet",".","This","script","was","written","in","reference","to","the","following","version","of","the","corpus","as","listed","on","ELRA",":","This","class\/script",",","together","with","the","corresponding","configuration","file","`","conf\/dataprep.yaml","`","perform","all","required","data","prep",".","..","_ELRA-S0030_02",":","http",":","\/\/catalog.elra.info\/en-us\/repository\/browse\/ELRA-S0030_02"]
docstr: Generate a new, randomized partition.
  
  Generate a new, randomized partition for the corpus for
  train/dev/test using the breakdowns provided in `splits`.
  
  Args:
      corpus(:obj:`dict`): The parsed, merged corpus to split.
      splits(str): A comma separated list of train/dev/test sum to 1.0.
docstr_tok: ["Generate","a","new",",","randomized","partition",".","Generate","a","new",",","randomized","partition","for","the","corpus","for","train\/dev\/test","using","the","breakdowns","provided","in","`","splits","`",".","Args",":","corpus","(",":","obj",":","`","dict","`",")",":","The","parsed",",","merged","corpus","to","split",".","splits","(","str",")",":","A","comma","separated","list","of","train\/dev\/test","sum","to","1.0","."]
code: def _generate_random(self, corpus, splits):
      """Generate a new, randomized partition.
  
      Generate a new, randomized partition for the corpus for
      train/dev/test using the breakdowns provided in `splits`.
  
      Args:
          corpus(:obj:`dict`): The parsed, merged corpus to split.
          splits(str): A comma separated list of train/dev/test sum to 1.0.
  
      """
      tr, dv, te = [float(val) for val in splits.split(",")]
      count = len(self.spkr2utts.keys())
      tr = int(tr * count)
      dv = int(dv * count)
      te = count - dv - tr
      print(tr, dv, te)
  
      items = list(self.spkr2utts.items())
      shuffle(items)
  
      for idx, spkr_item in enumerate(items):
          for d_item in spkr_item[1]:
              item = [d_item, corpus[d_item]]
              wav_line = "{0} {1}".format(item[0], item[1]["wav"])
              text_line = "{0} {1}".format(item[0], item[1]["text"])
              utt2gender_line = "{0} {1}".format(
                  item[0], item[1]["gender"]
              )
              utt2spk_line = "{0} {1}".format(item[0], spkr_item[0])
  
              if idx >= 0 and idx < tr:
                  print(wav_line, file=self.tr_wav_ofp)
                  print(text_line, file=self.tr_text_ofp)
                  print(utt2gender_line, file=self.tr_utt2gender_ofp)
                  print(utt2spk_line, file=self.tr_utt2spk_ofp)
              elif idx >= tr and idx < tr + dv:
                  print(wav_line, file=self.dv_wav_ofp)
                  print(text_line, file=self.dv_text_ofp)
                  print(utt2gender_line, file=self.dv_utt2gender_ofp)
                  print(utt2spk_line, file=self.dv_utt2spk_ofp)
              else:
                  print(wav_line, file=self.te_wav_ofp)
                  print(text_line, file=self.te_text_ofp)
                  print(utt2gender_line, file=self.te_utt2gender_ofp)
                  print(utt2spk_line, file=self.te_utt2spk_ofp)
  
          spk2utt_line = "{0} {1}".format(
              spkr_item[0], " ".join(spkr_item[1])
          )
          if idx >= 0 and idx < tr:
              print(spk2utt_line, file=self.tr_spk2utt_ofp)
          elif idx >= tr and idx < tr + dv:
              print(spk2utt_line, file=self.dv_spk2utt_ofp)
          else:
              print(spk2utt_line, file=self.te_spk2utt_ofp)
  
      return
  
imports: import os
  import pathlib
  import re
  import subprocess
  import sys
  from collections import defaultdict
  from random import shuffle
label_desc: Use image node_id 16 for calling the FrPolyphonePrepper obj's underlying member method code with example usage: obj._generate_random(corpus, splits) without return types