class_docstr: TextSim class for computing textual similarity.
  
  TextSim leverages the RETSim embedding model to compute the syntactic
  similarity between texts, retrieve similar documents, and deduplicate
  datasets. The model is a highly-optimized, small model that runs
  efficiently on both GPU and CPU, which makes TextSim significantly faster
  than traditional edit distance-based techniques and other neural-based
  embeddings.
  
  For more details on the RETSim model, please see TODO (marinazh) [paper link].
class_docstr_tok: ["TextSim","class","for","computing","textual","similarity",".","TextSim","leverages","the","RETSim","embedding","model","to","compute","the","syntactic","similarity","between","texts",",","retrieve","similar","documents",",","and","deduplicate","datasets",".","The","model","is","a","highly-optimized",",","small","model","that","runs","efficiently","on","both","GPU","and","CPU",",","which","makes","TextSim","significantly","faster","than","traditional","edit","distance-based","techniques","and","other","neural-based","embeddings",".","For","more","details","on","the","RETSim","model",",","please","see","TODO","(","marinazh",")","[","paper","link","]","."]
docstr: Create TextSim to index, search, and compute similarity between
  texts using RETSim embedding model.
  
  Args:
      store_data: Whether to store a copy of the indexed data and return
          data when returning search results. For large datasets
          (e.g. millions of items), we recommend setting store_data=False
          to reduce memory usage.
  
      index_type: Indexer type, either "exact" for exact search or
          "approx" for Approximate Nearest Neighbor (ANN) search. Using
          exact search guarantees you will return the most similar texts
          to your search queries every single time. We recommend using
          "approx" for large datasets for computational efficiency and it
          is accurate >99% of the time.
  
      return_embeddings: Whether to return the embeddings corresponding
          to each search result when calling TextSim.search().
  
      batch_size: Batch size for model inference.
  
      use_accelerator: Whether to use an accelerator (GPU), if available.
  
      model_id: String id of the model. Defaults to "text/retsim/v1" for
          the RETSim model.
  
      index_params: Additional parameters to be passed into the Indexer,
          only used when index_type is "approx" (ANN search). Supported
          dict keys include {dtype, connectivity, expansion_add,
          expansion_search}, please see the USearch Index documentation
          for more details (https://github.com/unum-cloud/usearch).
  
      verbose: Verbosity level, set to 1 for verbose.
docstr_tok: ["Create","TextSim","to","index",",","search",",","and","compute","similarity","between","texts","using","RETSim","embedding","model",".","Args",":","store_data",":","Whether","to","store","a","copy","of","the","indexed","data","and","return","data","when","returning","search","results",".","For","large","datasets","(","e.g",".","millions","of","items",")",",","we","recommend","setting","store_data=False","to","reduce","memory","usage",".","index_type",":","Indexer","type",",","either","``","exact","''","for","exact","search","or","``","approx","''","for","Approximate","Nearest","Neighbor","(","ANN",")","search",".","Using","exact","search","guarantees","you","will","return","the","most","similar","texts","to","your","search","queries","every","single","time",".","We","recommend","using","``","approx","''","for","large","datasets","for","computational","efficiency","and","it","is","accurate",">","99","%","of","the","time",".","return_embeddings",":","Whether","to","return","the","embeddings","corresponding","to","each","search","result","when","calling","TextSim.search","(",")",".","batch_size",":","Batch","size","for","model","inference",".","use_accelerator",":","Whether","to","use","an","accelerator","(","GPU",")",",","if","available",".","model_id",":","String","id","of","the","model",".","Defaults","to","``","text\/retsim\/v1","''","for","the","RETSim","model",".","index_params",":","Additional","parameters","to","be","passed","into","the","Indexer",",","only","used","when","index_type","is","``","approx","''","(","ANN","search",")",".","Supported","dict","keys","include","{","dtype",",","connectivity",",","expansion_add",",","expansion_search","}",",","please","see","the","USearch","Index","documentation","for","more","details","(","https",":","\/\/github.com\/unum-cloud\/usearch",")",".","verbose",":","Verbosity","level",",","set","to","1","for","verbose","."]
code: def __init__(
      self,
      store_data: bool = True,
      index_type: str | IndexerType = "exact",
      return_embeddings: bool = True,
      batch_size: int = 128,
      use_accelerator: bool = True,
      model_id: str = "text/retsim/v1",
      index_params: Dict[str, Any] | None = None,
      verbose: int = 0,
  ):
      """Create TextSim to index, search, and compute similarity between
      texts using RETSim embedding model.
  
      Args:
          store_data: Whether to store a copy of the indexed data and return
              data when returning search results. For large datasets
              (e.g. millions of items), we recommend setting store_data=False
              to reduce memory usage.
  
          index_type: Indexer type, either "exact" for exact search or
              "approx" for Approximate Nearest Neighbor (ANN) search. Using
              exact search guarantees you will return the most similar texts
              to your search queries every single time. We recommend using
              "approx" for large datasets for computational efficiency and it
              is accurate >99% of the time.
  
          return_embeddings: Whether to return the embeddings corresponding
              to each search result when calling TextSim.search().
  
          batch_size: Batch size for model inference.
  
          use_accelerator: Whether to use an accelerator (GPU), if available.
  
          model_id: String id of the model. Defaults to "text/retsim/v1" for
              the RETSim model.
  
          index_params: Additional parameters to be passed into the Indexer,
              only used when index_type is "approx" (ANN search). Supported
              dict keys include {dtype, connectivity, expansion_add,
              expansion_search}, please see the USearch Index documentation
              for more details (https://github.com/unum-cloud/usearch).
  
          verbose: Verbosity level, set to 1 for verbose.
      """
      embedder = TextEmbedder(
          batch_size=batch_size,
          model_id=model_id,
          verbose=verbose,
      )
      super().__init__(
          store_data=store_data,
          index_type=index_type,
          return_embeddings=return_embeddings,
          batch_size=batch_size,
          use_accelerator=use_accelerator,
          model_id=model_id,
          embedder=embedder,
          index_params=index_params,
          verbose=verbose,
      )
  
file_path: unisim/unisim/textsim.py
imports: from typing import Any, Dict, List, Sequence
  from pandas import DataFrame
  from tabulate import tabulate
  from .dataclass import Result, ResultCollection
  from .embedder import TextEmbedder
  from .enums import IndexerType
  from .types import BatchEmbeddings
  from .unisim import UniSim
label_desc: Use image node_id 1 to create a new TextSim object from inherited base classes: UniSim with example: obj = TextSim(store_data, index_type, return_embeddings, batch_size, use_accelerator, model_id, index_params, verbose)