class_docstr: Stores data in-memory. It's ephemeral and cannot be saved to disk.
docstr: Initializes the DocumentStore.
  
  :param bm25_tokenization_regex: The regular expression used to tokenize the text for BM25 retrieval.
  :param bm25_algorithm: The BM25 algorithm to use. One of "BM25Okapi", "BM25L", or "BM25Plus".
  :param bm25_parameters: Parameters for BM25 implementation in a dictionary format.
                          For example: {'k1':1.5, 'b':0.75, 'epsilon':0.25}
                          You can learn more about these parameters by visiting https://github.com/dorianbrown/rank_bm25.
                          By default, no parameters are set.
  :param embedding_similarity_function: The similarity function used to compare Documents embeddings.
                                        One of "dot_product" (default) or "cosine".
                                        To choose the most appropriate function, look for information about your embedding model.
docstr_tok: ["Initializes","the","DocumentStore",".",":","param","bm25_tokenization_regex",":","The","regular","expression","used","to","tokenize","the","text","for","BM25","retrieval",".",":","param","bm25_algorithm",":","The","BM25","algorithm","to","use",".","One","of","``","BM25Okapi","''",",","``","BM25L","''",",","or","``","BM25Plus","''",".",":","param","bm25_parameters",":","Parameters","for","BM25","implementation","in","a","dictionary","format",".","For","example",":","{","'k1':1.5",",","'","b':0.75",",","'epsilon':0.25","}","You","can","learn","more","about","these","parameters","by","visiting","https",":","\/\/github.com\/dorianbrown\/rank_bm25",".","By","default",",","no","parameters","are","set",".",":","param","embedding_similarity_function",":","The","similarity","function","used","to","compare","Documents","embeddings",".","One","of","``","dot_product","''","(","default",")","or","``","cosine","''",".","To","choose","the","most","appropriate","function",",","look","for","information","about","your","embedding","model","."]
code: def __init__(
      self,
      bm25_tokenization_regex: str = r"(?u)\b\w\w+\b",
      bm25_algorithm: Literal[
          "BM25Okapi", "BM25L", "BM25Plus"
      ] = "BM25Okapi",
      bm25_parameters: Optional[Dict] = None,
      embedding_similarity_function: Literal[
          "dot_product", "cosine"
      ] = "dot_product",
  ):
      """
      Initializes the DocumentStore.
  
      :param bm25_tokenization_regex: The regular expression used to tokenize the text for BM25 retrieval.
      :param bm25_algorithm: The BM25 algorithm to use. One of "BM25Okapi", "BM25L", or "BM25Plus".
      :param bm25_parameters: Parameters for BM25 implementation in a dictionary format.
                              For example: {'k1':1.5, 'b':0.75, 'epsilon':0.25}
                              You can learn more about these parameters by visiting https://github.com/dorianbrown/rank_bm25.
                              By default, no parameters are set.
      :param embedding_similarity_function: The similarity function used to compare Documents embeddings.
                                            One of "dot_product" (default) or "cosine".
                                            To choose the most appropriate function, look for information about your embedding model.
      """
      self.storage: Dict[str, Document] = {}
      self._bm25_tokenization_regex = bm25_tokenization_regex
      self.tokenizer = re.compile(bm25_tokenization_regex).findall
      algorithm_class = getattr(rank_bm25, bm25_algorithm)
      if algorithm_class is None:
          raise ValueError(
              f"BM25 algorithm '{bm25_algorithm}' not found."
          )
      self.bm25_algorithm = algorithm_class
      self.bm25_parameters = bm25_parameters or {}
      self.embedding_similarity_function = embedding_similarity_function
  
imports: import re
  from typing import Literal, Any, Dict, List, Optional, Iterable
  import logging
  import numpy
  from haystack_bm25 import rank_bm25
  from tqdm.auto import tqdm
  from haystack import default_from_dict, default_to_dict
  from haystack.dataclasses import Document
  from haystack.document_stores.types import DuplicatePolicy
  from haystack.utils.filters import document_matches_filter, convert
  from haystack.document_stores.errors import DuplicateDocumentError, DocumentStoreError
  from haystack.utils import expit
label_desc: Use image node_id 1 to create a new InMemoryDocumentStore object  with example: obj = InMemoryDocumentStore(bm25_tokenization_regex, bm25_algorithm, bm25_parameters, embedding_similarity_function)