def get_frame_top(lf):
  """Gets the frame (listing intent and slot labels) of a TopLF.

  Nested slots will be represented with a dot notation (e.g.,
  "slot1.intent2.slot3"). To avoid including all levels of nested slots,
  only slots with at least one leaf token as a direct child will be included.

  Args:
    lf: a TopLF object or a serialized logical form string.

  Returns:
    the frame string "intent-slot1-slot2-..."
  """
  if isinstance(lf, str):
    lf = deserialize_top(lf)
  args = set()

  def traverse(x, prefix="", top_level=False):
    if not top_level:
      prefix += x.name
    for v in x.args:
      if isinstance(v, TopLF):
        traverse(v, prefix + ".")
      else:
        args.add(prefix.lstrip("."))

  traverse(lf, top_level=True)
  return "-".join([lf.name] + sorted(args))
Gets the frame (listing intent and slot labels) of a TopLF.

  Nested slots will be represented with a dot notation (e.g.,
  "slot1.intent2.slot3"). To avoid including all levels of nested slots,
  only slots with at least one leaf token as a direct child will be included.

  Args:
    lf: a TopLF object or a serialized logical form string.

  Returns:
    the frame string "intent-slot1-slot2-..."
  
se2/src/utils/top_utils.py