def anonymize_top_lf_labels(
    lfs: Sequence[top_utils.TopLF],
    anonymized_labels: Optional[Sequence[str]] = None,
    anonymized_labels_type: Optional[str] = None) -> None:
  """Anonymizes the intent/slot labels of the TopLFs in place.

  Args:
    lfs: List of TopLF objects.
    anonymized_labels: List of anonymized labels to use. The first intent/slot
      label will be replaced with the first entry of `anonymized_labels` and so
      on. If not specified, use a list based on `anonymized_labels_type`.
    anonymized_labels_type: Type of anonymized labels when `anonymized_labels`
      is not specified.
  """
  if not anonymized_labels:
    if anonymized_labels_type == "numbers":
      # Use a random list of numbers as anonymized labels
      anonymized_labels = list(range(_MAX_NUM_LABELS))
    elif anonymized_labels_type == "mtop":
      # Use a random list of labels from the MTOP dataset
      # Warning: This exposes unseen labels in the domain boostrapping setup.
      anonymized_labels = top_constants.MTOP_LABELS[:]
    else:
      raise ValueError(
          "Unknown anonymized_label_type: {}".format(anonymized_labels_type))
    random.shuffle(anonymized_labels)
  anonymized_labels_iter = iter(anonymized_labels)
  label_map = {}
  for lf in lfs:
    stack: List[top_utils.TopLF] = [lf]
    while stack:
      sub_lf = stack.pop()
      if sub_lf.name not in label_map:
        # "IN:CREATE_ALARM" --> "IN:87"
        label_map[sub_lf.name] = (
            sub_lf.name[:3] + str(next(anonymized_labels_iter)))
      sub_lf.name = label_map[sub_lf.name]
      for child in reversed(sub_lf.args):
        if isinstance(child, top_utils.TopLF):
          stack.append(child)
Anonymizes the intent/slot labels of the TopLFs in place.

  Args:
    lfs: List of TopLF objects.
    anonymized_labels: List of anonymized labels to use. The first intent/slot
      label will be replaced with the first entry of `anonymized_labels` and so
      on. If not specified, use a list based on `anonymized_labels_type`.
    anonymized_labels_type: Type of anonymized labels when `anonymized_labels`
      is not specified.
  
language/casper/augment/casper_formatters.py