def _convert_target_sentences(
      self,
      target,
  ):
    """Converts target text to sentence renderables."""
    sentences = []
    for start, end in self.sentence_tokenizer.span_tokenize(target["text"]):
      text = target["text"][start:end]
      entities = target["added_entities"]
      entity_ids = {
          e["id"] for e in entities if e["start"] >= start and e["end"] <= end
      }
      # Target sentences do not contain evidence markers if we are in the
      # controllable setting.
      if self.task == Task.controllable:
        evidence_marker_type = EvidenceMarkerType.empty
      else:
        evidence_marker_type = self.evidence_marker_type
      sentence = Sentence(
          "",  # Targets sentences are never delimited.
          text,
          evidence_marker_type=evidence_marker_type,
          entity_ids=entity_ids,
      )
      sentences.append(sentence)
    return sentences
Converts target text to sentence renderables.
language/fruit/rendering_utils.py