code: def determine_labels(target_dir: Path, label_type: str) -> Set[str]:
      
      logger.info("Finding phonemes of type %s in directory %s", label_type, target_dir)
  
      label_dir = target_dir / "label/"
      if not label_dir.is_dir():
          raise FileNotFoundError(
              "The directory {} does not exist.".format(target_dir))
  
      phonemes = set() # type: Set[str]
      for fn in os.listdir(str(label_dir)):
          if fn.endswith(str(label_type)):
              with (label_dir / fn).open("r", encoding=ENCODING) as f:
                  try:
                      line_phonemes = set(f.readline().split())
                  except UnicodeDecodeError:
                      logger.error("Unicode decode error on file %s", fn)
                      print("Unicode decode error on file {}".format(fn))
                      raise
                  phonemes = phonemes.union(line_phonemes)
      return phonemes
docs: Returns a set of all phonemes found in the corpus. Assumes that WAV files and
      label files are split into utterances and segregated in a directory which contains a
      "wav" subdirectory and "label" subdirectory.
  
      Arguments:
          target_dir: A `Path` to the directory where the corpus data is found
          label_type: The type of label we are creating the label set from. For example
                      "phonemes" would only search for labels for that type.