docs: def prepare_feats(feat_type, org_wav_dir=ORG_WAV_DIR, feat_dir=FEAT_DIR, tgt_wav_dir=TGT_WAV_DIR,
                    org_xml_dir=ORG_XML_DIR, label_dir=LABEL_DIR):
      """ Prepare the input features."""
  
      if not os.path.isdir(TGT_DIR):
          os.makedirs(TGT_DIR)
  
      if not os.path.isdir(FEAT_DIR):
          os.makedirs(FEAT_DIR)
  
      if not os.path.isdir(os.path.join(feat_dir, "WORDLIST")):
          os.makedirs(os.path.join(feat_dir, "WORDLIST"))
      if not os.path.isdir(os.path.join(feat_dir, "TEXT")):
          os.makedirs(os.path.join(feat_dir, "TEXT"))
  
      # Extract utterances from WAVS.
      trim_wavs(org_wav_dir=org_wav_dir,
                tgt_wav_dir=tgt_wav_dir,
                org_xml_dir=org_xml_dir)
  
      # TODO Currently assumes that the wav trimming from XML has already been
      # done.
      prefixes = []
      for fn in os.listdir(os.path.join(tgt_wav_dir, "WORDLIST")):
          if fn.endswith(".wav"):
              pre, _ = os.path.splitext(fn)
              prefixes.append(os.path.join("WORDLIST", pre))
      for fn in os.listdir(os.path.join(tgt_wav_dir, "TEXT")):
          if fn.endswith(".wav"):
              pre, _ = os.path.splitext(fn)
              prefixes.append(os.path.join("TEXT", pre))
  
      if feat_type=="phonemes_onehot":
          import numpy as np
          #prepare_labels("phonemes")
          for prefix in prefixes:
              label_fn = os.path.join(label_dir, "%s.phonemes" % prefix)
              out_fn = os.path.join(feat_dir, "%s.phonemes_onehot" %  prefix)
              try:
                  with open(label_fn) as label_f:
                      labels = label_f.readlines()[0].split()
              except FileNotFoundError:
                  continue
              indices = [PHONEMES_TO_INDICES[label] for label in labels]
              one_hots = [[0]*len(PHONEMES) for _ in labels]
              for i, index in enumerate(indices):
                  one_hots[i][index] = 1
                  one_hots = np.array(one_hots)
                  np.save(out_fn, one_hots)
      else:
          # Otherwise, 
          for prefix in prefixes:
              # Convert the wave to 16k mono.
              wav_fn = os.path.join(tgt_wav_dir, "%s.wav" % prefix)
              mono16k_wav_fn = os.path.join(feat_dir, "%s.wav" % prefix)
              if not os.path.isfile(mono16k_wav_fn):
                  logging.info("Normalizing wav {} to a 16k 16KHz mono {}".format(
                      wav_fn, mono16k_wav_fn))
                  feat_extract.convert_wav(wav_fn, mono16k_wav_fn)
  
          # Extract features from the wavs.
          feat_extract.from_dir(Path(os.path.join(feat_dir, "WORDLIST")), feat_type=feat_type)
          feat_extract.from_dir(Path(os.path.join(feat_dir, "TEXT")), feat_type=feat_type)