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: The primary corpus processing entrypoint.
  
  The primary corpus processing entrypoint. There is a lot
  of boilerplate here.  This method organizes the data into
  the basic structures expected by the kaldi(and espnet)
  example training recipes.
  
  Args:
      trans(str): File containing complete corpus listing.
      fbank_conf(str): The filterbank yaml config file.
docstr_tok: ["The","primary","corpus","processing","entrypoint",".","The","primary","corpus","processing","entrypoint",".","There","is","a","lot","of","boilerplate","here",".","This","method","organizes","the","data","into","the","basic","structures","expected","by","the","kaldi","(","and","espnet",")","example","training","recipes",".","Args",":","trans","(","str",")",":","File","containing","complete","corpus","listing",".","fbank_conf","(","str",")",":","The","filterbank","yaml","config","file","."]
code: def processcorpus(self, trans, fbank_conf):
      """The primary corpus processing entrypoint.
  
      The primary corpus processing entrypoint. There is a lot
      of boilerplate here.  This method organizes the data into
      the basic structures expected by the kaldi(and espnet)
      example training recipes.
  
      Args:
          trans(str): File containing complete corpus listing.
          fbank_conf(str): The filterbank yaml config file.
  
      """
      fbank = self._loadconf(fbank_conf)
      datadir = "data"
      text_file = trans
      out_dir = os.path.join(datadir, "preprocess")
      spk2utt = defaultdict(list)
      if not os.path.isdir(out_dir):
          pathlib.Path(out_dir).mkdir(parents=True, exist_ok=True)
  
      spkr_ofp = open(
          os.path.join(out_dir, "utt2spk"), "w", encoding="utf-8"
      )
      gndr_ofp = open(
          os.path.join(out_dir, "utt2gender"), "w", encoding="utf-8"
      )
      text_ofp = open(
          os.path.join(out_dir, "text"), "w", encoding="utf-8"
      )
      wav_ofp = open(
          os.path.join(out_dir, "wav.scp"), "w", encoding="utf-8"
      )
      with open(text_file) as ifp:
          for line in ifp:
              uttid, text, gender, spkrid = self._processline(line)
  
              if re.match(r"^\s*$", text):
                  print(
                      "Empty utterance: {0}".format(uttid),
                      file=sys.stderr,
                  )
                  continue
  
              spk2utt[spkrid].append(uttid)
              print("{0} {1}".format(uttid, spkrid), file=spkr_ofp)
              print("{0} {1}".format(uttid, gender), file=gndr_ofp)
              print("{0} {1}".format(uttid, text), file=text_ofp)
              sample = "{0} ffmpeg -i {1} -f wav -ar {2} -ab 16 - |"
              sample = sample.format(
                  uttid,
                  self.audiocorpus[uttid],
                  fbank["--sample-frequency"],
              )
              print(sample, file=wav_ofp)
  
      spkr_ofp.close()
      gndr_ofp.close()
      text_ofp.close()
      wav_ofp.close()
  
      spkr2utt_ofp = open(os.path.join(out_dir, "spk2utt"), "w")
      for key, vals in spk2utt.items():
          print(
              "{0} {1}".format(key, " ".join(vals)), file=spkr2utt_ofp
          )
      spkr2utt_ofp.close()
  
      # This is a necessary evil.
      self._collatecorpusdata("data", "preprocess")
  
      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 13 for calling the FrPolyphonePrepper obj's underlying member method code with example usage: obj.processcorpus(trans, fbank_conf) without return types