docs: def preprocess_na(sent, label_type):
      """Preprocess Na sentences
  
      Args:
          sent: A sentence
          label_type: The type of label provided
      """
      if label_type == "phonemes_and_tones":
          phonemes = True
          tones = True
          tgm = True
      elif label_type == "phonemes_and_tones_no_tgm":
          phonemes = True
          tones = True
          tgm = False
      elif label_type == "phonemes":
          phonemes = True
          tones = False
          tgm = False
      elif label_type == "tones":
          phonemes = False
          tones = True
          tgm = True
      elif label_type == "tones_notgm":
          phonemes = False
          tones = True
          tgm = False
      else:
          raise ValueError("Unrecognized label type: %s" % label_type)
  
      def pop_phoneme(sentence):
          """Pop phonemes off a sentence one at a time"""
          # TODO desperately needs refactoring
  
          # Treating fillers as single tokens; normalizing to əəə and mmm
          if phonemes:
              if sentence[:4] in ["əəə…", "mmm…"]:
                  return sentence[:4], sentence[4:]
              if sentence.startswith("ə…"):
                  return "əəə…", sentence[2:]
              if sentence.startswith("m…"):
                  return "mmm…", sentence[2:]
              if sentence.startswith("mm…"):
                  return "mmm…", sentence[3:]
  
          # Normalizing some stuff
          if sentence[:3] == "wæ̃":
              if phonemes:
                  return "w̃æ", sentence[3:]
              else:
                  return None, sentence[3:]
          if sentence[:3] == "ṽ̩":
              if phonemes:
                  return "ṽ̩", sentence[3:]
              else:
                  return None, sentence[3:]
  
          if sentence[:3] in TRI_PHNS:
              if phonemes:
                  return sentence[:3], sentence[3:]
              else:
                  return None, sentence[3:]
          if sentence[:2] in BI_PHNS:
              if phonemes:
                  return sentence[:2], sentence[2:]
              else:
                  return None, sentence[2:]
          if sentence[:2] == "˧̩":
              return "˧", sentence[2:]
          if sentence[:2] == "˧̍":
              return "˧", sentence[2:]
          if sentence[0] in UNI_PHNS:
              if phonemes:
                  return sentence[0], sentence[1:]
              else:
                  return None, sentence[1:]
          if sentence[:2] in BI_TONES:
              if tones:
                  return sentence[:2], sentence[2:]
              else:
                  return None, sentence[2:]
          if sentence[0] in UNI_TONES:
              if tones:
                  return sentence[0], sentence[1:]
              else:
                  return None, sentence[1:]
          if sentence[0] in MISC_SYMBOLS:
              # We assume these symbols cannot be captured.
              return None, sentence[1:]
          if sentence[0] in BAD_NA_SYMBOLS:
              return None, sentence[1:]
          if sentence[0] in PUNC_SYMBOLS:
              return None, sentence[1:]
          if sentence[0] in ["-", "ʰ", "/"]:
              return None, sentence[1:]
          if sentence[0] in set(["<", ">"]):
              # We keep everything literal, thus including what is in <>
              # brackets; so we just remove these tokens"
              return None, sentence[1:]
          if sentence[0] == "[":
              # It's an opening square bracket, so ignore everything until we
              # find a closing one.
              if sentence.find("]") == len(sentence)-1:
                  # If the closing bracket is the last char
                  return None, ""
              else:
                  return None, sentence[sentence.find("]")+1:]
          if sentence[0] in set([" ", "\t", "\n"]):
              # Return a space char so that it can be identified in word segmentation
              # processing.
              return " ", sentence[1:]
          if sentence[0] == "|" or sentence[0] == "ǀ" or sentence[0] == "◊":
              # TODO Address extrametrical span symbol ◊ differently. For now,
              # treating it as a tone group boundary marker for consistency with
              # previous work.
              if tgm:
                  return "|", sentence[1:]
              else:
                  return None, sentence[1:]
          if sentence[0] in "()":
              return None, sentence[1:]
          print("***" + sentence)
          raise ValueError("Next character not recognized: " + sentence[:1])
  
      def filter_for_phonemes(sentence):
          """ Returns a sequence of phonemes and pipes (word delimiters). Tones,
          syllable boundaries, whitespace are all removed."""
  
          filtered_sentence = []
          while sentence != "":
              phoneme, sentence = pop_phoneme(sentence)
              if phoneme != " ":
                  filtered_sentence.append(phoneme)
          filtered_sentence = [item for item in filtered_sentence if item != None]
          return " ".join(filtered_sentence)
  
      # Filter utterances with certain words
      if "BEGAIEMENT" in sent:
          return ""
      sent = filter_for_phonemes(sent)
      return sent