class_docstr: Makes text documents more readable by removing extra whitespaces, empty lines, specified substrings, regexes, page headers and footers (in this order).
  This is useful for preparing the documents for further processing by LLMs.
  
  Example usage in an indexing pipeline:
  
  ```python
  document_store = InMemoryDocumentStore()
  p = Pipeline()
  p.add_component(instance=TextFileToDocument(), name="text_file_converter")
  p.add_component(instance=DocumentCleaner(), name="cleaner")
  p.add_component(instance=TextDocumentSplitter(split_by="sentence", split_length=1), name="splitter")
  p.add_component(instance=DocumentWriter(document_store=document_store), name="writer")
  p.connect("text_file_converter.documents", "cleaner.documents")
  p.connect("cleaner.documents", "splitter.documents")
  p.connect("splitter.documents", "writer.documents")
  ```
class_docstr_tok: ["Makes","text","documents","more","readable","by","removing","extra","whitespaces",",","empty","lines",",","specified","substrings",",","regexes",",","page","headers","and","footers","(","in","this","order",")",".","This","is","useful","for","preparing","the","documents","for","further","processing","by","LLMs",".","Example","usage","in","an","indexing","pipeline",":","``","`","python","document_store","=","InMemoryDocumentStore","(",")","p","=","Pipeline","(",")","p.add_component","(","instance=TextFileToDocument","(",")",",","name=","''","text_file_converter","''",")","p.add_component","(","instance=DocumentCleaner","(",")",",","name=","''","cleaner","''",")","p.add_component","(","instance=TextDocumentSplitter","(","split_by=","''","sentence","''",",","split_length=1",")",",","name=","''","splitter","''",")","p.add_component","(","instance=DocumentWriter","(","document_store=document_store",")",",","name=","''","writer","''",")","p.connect","(","``","text_file_converter.documents","''",",","``","cleaner.documents","''",")","p.connect","(","``","cleaner.documents","''",",","``","splitter.documents","''",")","p.connect","(","``","splitter.documents","''",",","``","writer.documents","''",")","``","`"]
docstr: Remove extra whitespaces from text.
  :param text: Text to clean.
  :param return: The text without extra whitespaces.
docstr_tok: ["Remove","extra","whitespaces","from","text",".",":","param","text",":","Text","to","clean",".",":","param","return",":","The","text","without","extra","whitespaces","."]
code: def _remove_extra_whitespaces(self, text: str) -> str:
      """
      Remove extra whitespaces from text.
      :param text: Text to clean.
      :param return: The text without extra whitespaces.
      """
      return re.sub(r"\s\s+", " ", text).strip()
  
file_path: haystack/haystack/components/preprocessors/document_cleaner.py
imports: import logging
  import re
  from copy import deepcopy
  from functools import partial, reduce
  from itertools import chain
  from typing import Generator, List, Optional, Set
  from haystack import Document, component
label_desc: Use image node_id 4 for calling the DocumentCleaner obj's underlying member method code with example usage: obj._remove_extra_whitespaces(text) and returns: re