code: def _handle_sentence(
      examples: List[Tuple[str, str]]
  ) -> SpacyNerExample:
      """
      Processes a single sentence by building it up as a space separated string
      with its corresponding typed entity spans.
      """
      start_index = -1
      current_index = 0
      in_entity = False
      entity_type: str = ""
      sent = ""
      entities: List[Tuple[int, int, str]] = []
      for word, entity in examples:
          sent += word
          sent += " "
          if entity != "O":
              if in_entity:
                  pass
              else:
                  start_index = current_index
                  in_entity = True
                  entity_type = entity[2:].upper()
          else:
              if in_entity:
                  end_index = current_index - 1
                  entities.append(
                      (
                          start_index,
                          end_index,
                          entity_type.replace("-", "_"),
                      )
                  )
              in_entity = False
              entity_type = ""
              start_index = -1
          current_index += len(word) + 1
      if in_entity:
          end_index = current_index - 1
          entities.append((start_index, end_index, entity_type))
  
      # Remove last space.
      sent = sent[:-1]
      return (sent, {"entities": entities})
  
file_path: scispacy/scispacy/data_util.py
imports: from typing import Optional, NamedTuple, List, Iterator, Dict, Tuple
  import tarfile
  import atexit
  import os
  import shutil
  import tempfile
  from scispacy.file_cache import cached_path
label_desc: Use image node_id 6 for calling a global function with example usage: _handle_sentence(examples) and returns: sent,  dict