class_docstr: Splits a list of text documents into a list of text documents with shorter texts.
  This is useful for splitting documents with long texts that otherwise would not fit into the maximum text length of language models.
code: def _split_into_units(
      self, text: str, split_by: Literal["word", "sentence", "passage"]
  ) -> List[str]:
      if split_by == "passage":
          split_at = "\n\n"
      elif split_by == "sentence":
          split_at = "."
      elif split_by == "word":
          split_at = " "
      else:
          raise NotImplementedError(
              "DocumentSplitter only supports 'passage', 'sentence' or 'word' split_by options."
          )
      units = text.split(split_at)
      # Add the delimiter back to all units except the last one
      for i in range(len(units) - 1):
          units[i] += split_at
      return units
  
file_path: haystack/haystack/components/preprocessors/document_splitter.py
imports: from copy import deepcopy
  from typing import List, Literal
  from more_itertools import windowed
  from haystack import component, Document
label_desc: Use image node_id 3 for calling the DocumentSplitter obj's underlying member method code with example usage: obj._split_into_units(text, split_by) and returns: units