code: def _create_long_answer_from_span_text(simplified_example):
      """
      Creates a list of long answer candidates, from their spans on the document.
  
      This function gets the full article from the input simplified example
      dictionary (using key 'document_text'), then iterates through the long
      answer spans (from 'long_answer_candidates' key) and creates a list of
      slices from the article, using the 'start_token' and 'end_token' values in
      the list of long answer candidate spans.
  
      Returns a list of long answers. Each long answer is a substring from the
          simplified HTML text.
  
      :param simplified_example: a dict that contains one simplified example/entry
          from NQ dataset.
      """
      context_text = simplified_example[
          _context_type_key(is_html=False)
      ]
      candidate_long_answers = []
      splitted_tokens = context_text.split(" ")
      for long_answer_span in simplified_example[
          "long_answer_candidates"
      ]:
          start_index = long_answer_span["start_token"]
          end_index = long_answer_span["end_token"]
          answer = " ".join(splitted_tokens[start_index:end_index])
          candidate_long_answers.append(answer)
      return candidate_long_answers
  
imports: import copy
  import os
  import json
  import jsonlines
  from typing import List, Optional, Tuple
  from parlai.core.teachers import ChunkTeacher, DialogTeacher
  from .build import build, DATASET_NAME_LOCAL, build_sample
  from .build_open import build
  from .utils.text_utils import simplify_nq_example
  from parlai.core.opt import Opt
  from parlai.core.message import Message
  from parlai.core.metrics import ExactMatchMetric, normalize_answer, AverageMetric
  from parlai.core.params import ParlaiParser
  from parlai.utils.data import DatatypeHelper
  from parlai.utils.io import PathManager
  import parlai.utils.logging
label_desc: Use image node_id 4 for calling a global function with example usage: _create_long_answer_from_span_text(simplified_example) and returns: candidate_long_answers