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.
docstr: :param split_by: The unit by which the document should be split. Choose from "word" for splitting by " ",
  "sentence" for splitting by ".", or "passage" for splitting by "\n\n".
  :param split_length: The maximum number of units in each split.
  :param split_overlap: The number of units that each split should overlap.
code: def __init__(
      self,
      split_by: Literal["word", "sentence", "passage"] = "word",
      split_length: int = 200,
      split_overlap: int = 0,
  ):
      """
      :param split_by: The unit by which the document should be split. Choose from "word" for splitting by " ",
      "sentence" for splitting by ".", or "passage" for splitting by "\\n\\n".
      :param split_length: The maximum number of units in each split.
      :param split_overlap: The number of units that each split should overlap.
      """
  
      self.split_by = split_by
      if split_by not in ["word", "sentence", "passage"]:
          raise ValueError(
              "split_by must be one of 'word', 'sentence' or 'passage'."
          )
      if split_length <= 0:
          raise ValueError("split_length must be greater than 0.")
      self.split_length = split_length
      if split_overlap < 0:
          raise ValueError(
              "split_overlap must be greater than or equal to 0."
          )
      self.split_overlap = split_overlap
  
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 1 to create a new DocumentSplitter object  with example: obj = DocumentSplitter(split_by, split_length, split_overlap)