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: Generates all possible ngrams from a given sequence of text.
  Considering all ngram lengths between the minimum and maximum length.
  
  :param seq: The sequence to generate ngrams from.
  :param min_ngram: The minimum length of ngram to consider.
  :param max_ngram: The maximum length of ngram to consider.
  :return: A set of all ngrams from the given sequence.
docstr_tok: ["Generates","all","possible","ngrams","from","a","given","sequence","of","text",".","Considering","all","ngram","lengths","between","the","minimum","and","maximum","length",".",":","param","seq",":","The","sequence","to","generate","ngrams","from",".",":","param","min_ngram",":","The","minimum","length","of","ngram","to","consider",".",":","param","max_ngram",":","The","maximum","length","of","ngram","to","consider",".",":","return",":","A","set","of","all","ngrams","from","the","given","sequence","."]
code: def _allngram(
      self, seq: str, min_ngram: int, max_ngram: int
  ) -> Set[str]:
      """
      Generates all possible ngrams from a given sequence of text.
      Considering all ngram lengths between the minimum and maximum length.
  
      :param seq: The sequence to generate ngrams from.
      :param min_ngram: The minimum length of ngram to consider.
      :param max_ngram: The maximum length of ngram to consider.
      :return: A set of all ngrams from the given sequence.
      """
      lengths = (
          range(min_ngram, max_ngram)
          if max_ngram
          else range(min_ngram, len(seq))
      )
      ngrams = map(partial(self._ngram, seq), lengths)
      res = set(chain.from_iterable(ngrams))
      return res
  
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 10 for calling the DocumentCleaner obj's underlying member method code with example usage: obj._allngram(seq, min_ngram, max_ngram) and returns: res