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: Guess the encoding type.
  
  Guess the file encoding type.  Some are DOS850, but most are
  actually just iso-8859-1.  This is actually independent of which
  directory the files are in.  Some DOS are still iso-8859-1.
docstr_tok: ["Guess","the","encoding","type",".","Guess","the","file","encoding","type",".","Some","are","DOS850",",","but","most","are","actually","just","iso-8859-1",".","This","is","actually","independent","of","which","directory","the","files","are","in",".","Some","DOS","are","still","iso-8859-1","."]
code: def guess_encoding(self, infile):
      """Guess the encoding type.
  
      Guess the file encoding type.  Some are DOS850, but most are
      actually just iso-8859-1.  This is actually independent of which
      directory the files are in.  Some DOS are still iso-8859-1.
      """
      mime = subprocess.Popen(
          "/usr/bin/file --mime {0}".format(infile),
          shell=True,
          stdout=subprocess.PIPE,
      ).communicate()[0]
  
      mime = re.split(r"\s+", mime.decode("utf8").strip())[-1]
      mime = re.sub(r"^charset=", "", mime)
  
      if mime == "unknown-8bit":
          return "850"
  
      return mime
  
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 8 for calling the FrPolyphonePrepper obj's underlying member method code with example usage: obj.guess_encoding(infile) and returns: mime, str