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: Create or read the train/dev/test splits.
  
  Create or read in the existing train/dev/test splits.  If the reference
  lists are provided for replication, then these are used directly.
  Otherwise the lists are generated randomly from the unique list of
  speaker IDs to ensure fully held-out data for dev/test.
  
  Args:
      train (str): The target path for training data.
      dev (str): The target path for development data.
      test (str): The target path for test data.
      splits (str): A comma separated list with 3 vals that sum to 1.0.
      useexisting (bool): Use existing replication lists or not.
docstr_tok: ["Create","or","read","the","train\/dev\/test","splits",".","Create","or","read","in","the","existing","train\/dev\/test","splits",".","If","the","reference","lists","are","provided","for","replication",",","then","these","are","used","directly",".","Otherwise","the","lists","are","generated","randomly","from","the","unique","list","of","speaker","IDs","to","ensure","fully","held-out","data","for","dev\/test",".","Args",":","train","(","str",")",":","The","target","path","for","training","data",".","dev","(","str",")",":","The","target","path","for","development","data",".","test","(","str",")",":","The","target","path","for","test","data",".","splits","(","str",")",":","A","comma","separated","list","with","3","vals","that","sum","to","1.0.","useexisting","(","bool",")",":","Use","existing","replication","lists","or","not","."]
code: def make_train_dev_test(self, train, dev, test, splits, useexisting):
      """Create or read the train/dev/test splits.
  
      Create or read in the existing train/dev/test splits.  If the reference
      lists are provided for replication, then these are used directly.
      Otherwise the lists are generated randomly from the unique list of
      speaker IDs to ensure fully held-out data for dev/test.
  
      Args:
          train (str): The target path for training data.
          dev (str): The target path for development data.
          test (str): The target path for test data.
          splits (str): A comma separated list with 3 vals that sum to 1.0.
          useexisting (bool): Use existing replication lists or not.
  
      """
      datadir = self.datadir
      train_path = os.path.join(datadir, train)
      dev_path = os.path.join(datadir, dev)
      test_path = os.path.join(datadir, test)
  
      for path in [train_path, dev_path, test_path]:
          if not os.path.isdir(path):
              os.mkdir(path)
  
      corpus = {}
      with open(os.path.join(datadir, "preprocess", "wav.scp")) as ifp:
          for line in ifp:
              parts = re.split(r"\s+", line.strip())
              uttid = parts.pop(0)
              wav = " ".join(parts)
              corpus[uttid] = {"wav": wav}
      with open(
          os.path.join(datadir, "preprocess", "utt2gender")
      ) as ifp:
          for line in ifp:
              uttid, gender = re.split(r"\s+", line.strip())
              corpus[uttid]["gender"] = gender
  
      self.spkr2utts = defaultdict(list)
      with open(os.path.join(datadir, "preprocess", "text")) as ifp:
          for line in ifp:
              parts = re.split(r"\s+", line.strip())
              uttid = parts.pop(0)
              text = " ".join(parts)
              corpus[uttid]["text"] = text
              corpus[uttid]["spkrid"] = uttid[0:5]
              self.spkr2utts[uttid[0:5]].append(uttid)
  
      self.tr_wav_ofp = open(os.path.join(train_path, "wav.scp"), "w")
      self.dv_wav_ofp = open(os.path.join(dev_path, "wav.scp"), "w")
      self.te_wav_ofp = open(os.path.join(test_path, "wav.scp"), "w")
  
      self.tr_text_ofp = open(os.path.join(train_path, "text"), "w")
      self.dv_text_ofp = open(os.path.join(dev_path, "text"), "w")
      self.te_text_ofp = open(os.path.join(test_path, "text"), "w")
  
      self.tr_utt2gender_ofp = open(
          os.path.join(train_path, "utt2gender"), "w"
      )
      self.dv_utt2gender_ofp = open(
          os.path.join(dev_path, "utt2gender"), "w"
      )
      self.te_utt2gender_ofp = open(
          os.path.join(test_path, "utt2gender"), "w"
      )
  
      self.tr_utt2spk_ofp = open(
          os.path.join(train_path, "utt2spk"), "w"
      )
      self.dv_utt2spk_ofp = open(os.path.join(dev_path, "utt2spk"), "w")
      self.te_utt2spk_ofp = open(
          os.path.join(test_path, "utt2spk"), "w"
      )
  
      self.tr_spk2utt_ofp = open(
          os.path.join(train_path, "spk2utt"), "w"
      )
      self.dv_spk2utt_ofp = open(os.path.join(dev_path, "spk2utt"), "w")
      self.te_spk2utt_ofp = open(
          os.path.join(test_path, "spk2utt"), "w"
      )
  
      if useexisting:
          self._replicate_existing(corpus)
      else:
          self._generate_random(corpus, splits)
  
      self._collatecorpusdata(datadir, train)
      self._collatecorpusdata(datadir, dev)
      self._collatecorpusdata(datadir, test)
  
      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 14 for calling the FrPolyphonePrepper obj's underlying member method code with example usage: obj.make_train_dev_test(train, dev, test, splits, useexisting) without return types