tools/traffic_annotation/scripts/generator_utils.py
def find_first_index(doc):
  """Finds the cursor index (location) that comes right after the Introduction
  section. Namely, the endIndex of the paragraph block the |target_text| belongs
  to.

  Returns: int
    The first cursor index (loc) of the template document, right after the
    Introduction section.
  """
  target_text = "The policy, if one exists, to control this type of network"
  padding = 1  # We pad so as to overwrite cleanly.

  body = extract_body(document=doc)
  contents = body["content"]
  for element in contents:
    if "paragraph" in element:
      end_index = element["endIndex"]
      lines = element["paragraph"]["elements"]
      for text_run in lines:
        if target_text in text_run["textRun"]["content"]:
          return end_index + padding
Finds the cursor index (location) that comes right after the Introduction
  section. Namely, the endIndex of the paragraph block the |target_text| belongs
  to.

  Returns: int
    The first cursor index (loc) of the template document, right after the
    Introduction section.
  
Finds the cursor index (location) that comes right after the Introduction
section. Namely, the endIndex of the paragraph block the |target_text| belongs
to.

int
The first cursor index (loc) of the template document, right after the
Introduction section.
Finds the cursor index ( location ) that comes right after the Introduction section . Namely the endIndex of the paragraph block the |target_text| belongs to . int The first cursor index ( loc ) of the template document right after the Introduction section .
def find_first_index(doc):
  target_text = "The policy, if one exists, to control this type of network"
  padding = 1  
  body = extract_body(document=doc)
  contents = body["content"]
  for element in contents:
    if "paragraph" in element:
      end_index = element["endIndex"]
      lines = element["paragraph"]["elements"]
      for text_run in lines:
        if target_text in text_run["textRun"]["content"]:
          return end_index + padding
def find_first_index ( doc ) : target_text = "The policy, if one exists, to control this type of network" padding = 1 body = extract_body ( document = doc ) contents = body [ "content" ] for element in contents : if "paragraph" in element : end_index = element [ "endIndex" ] lines = element [ "paragraph" ] [ "elements" ] for text_run in lines : if target_text in text_run [ "textRun" ] [ "content" ] : return end_index + padding
Finds the cursor index (location) that comes right after the Introduction
section.
Finds the cursor index ( location ) that comes right after the Introduction section .
"""Finds the cursor index (location) that comes right after the Introduction
  section. Namely, the endIndex of the paragraph block the |target_text| belongs
  to.

  Returns: int
    The first cursor index (loc) of the template document, right after the
    Introduction section.
  """ # We pad so as to overwrite cleanly.
doc