class_docstr: Abstract base class for UniSim.
  
  UniSim is designed to find near-duplicates and similar matches for content
  (such as text, images, multi-modal inputs) using embedding models. The
  UniSim packages enables finding the similarity between two items, indexing
  and querying for similar items, and finding near-duplicates in a dataset.
docstr: Find the closest matches for queries in a list of targets and
  return the result as a pandas DataFrame.
  
  Args:
      queries: Input queries to search for.
  
      targets: Targets to search in, e.g. for each query, find the nearest
          match in `targets`. If None, then `queries` is used as the
          targets as well and matches are computed within a single list.
  
      similarity_threshold: Similarity threshold for near-duplicate
          match, where a query and a search result are considered
          near-duplicate matches if their similarity is higher than
          `similarity_threshold`.
  
  Returns:
      Returns a pandas DataFrame with ["query", "target", "similarity", "is_match"]
      columns, representing each query, nearest match in `targets`, their similarity
      value, and whether or not they are a match (if their similarity >=
      `similarity_threshold`).
docstr_tok: ["Find","the","closest","matches","for","queries","in","a","list","of","targets","and","return","the","result","as","a","pandas","DataFrame",".","Args",":","queries",":","Input","queries","to","search","for",".","targets",":","Targets","to","search","in",",","e.g",".","for","each","query",",","find","the","nearest","match","in","`","targets","`",".","If","None",",","then","`","queries","`","is","used","as","the","targets","as","well","and","matches","are","computed","within","a","single","list",".","similarity_threshold",":","Similarity","threshold","for","near-duplicate","match",",","where","a","query","and","a","search","result","are","considered","near-duplicate","matches","if","their","similarity","is","higher","than","`","similarity_threshold","`",".","Returns",":","Returns","a","pandas","DataFrame","with","[","``","query","''",",","``","target","''",",","``","similarity","''",",","``","is_match","''","]","columns",",","representing","each","query",",","nearest","match","in","`","targets","`",",","their","similarity","value",",","and","whether","or","not","they","are","a","match","(","if","their","similarity",">","=","`","similarity_threshold","`",")","."]
code: def match(
      self,
      queries: Sequence[Any],
      targets: Sequence[Any] | None = None,
      similarity_threshold: float = 0.9,
  ) -> DataFrame:
      """Find the closest matches for queries in a list of targets and
      return the result as a pandas DataFrame.
  
      Args:
          queries: Input queries to search for.
  
          targets: Targets to search in, e.g. for each query, find the nearest
              match in `targets`. If None, then `queries` is used as the
              targets as well and matches are computed within a single list.
  
          similarity_threshold: Similarity threshold for near-duplicate
              match, where a query and a search result are considered
              near-duplicate matches if their similarity is higher than
              `similarity_threshold`.
  
      Returns:
          Returns a pandas DataFrame with ["query", "target", "similarity", "is_match"]
          columns, representing each query, nearest match in `targets`, their similarity
          value, and whether or not they are a match (if their similarity >=
          `similarity_threshold`).
      """
      # reset index
      self.reset_index()
  
      # defaults if we have targets
      drop_closest_match = False
      k = 1
  
      # if we are matching within the same list, drop the closest match
      # since it will be the query itself
      if not targets:
          targets = queries
          drop_closest_match = True
          k = 2
  
      # add all targets
      self.add(targets)
  
      # search all queries, so it doesn't depend on similarity threshold
      results = self.search(
          queries,
          similarity_threshold=0.0,
          k=k,
          drop_closest_match=drop_closest_match,
      ).results
  
      # create pandas df
      data = []
      for i in range(len(results)):
          query = queries[i]
          match = results[i].matches[0]
          similarity = match.similarity
          is_match = similarity and similarity >= similarity_threshold
          matched = targets[match.idx]
          data.append([query, matched, similarity, is_match])
  
      df = DataFrame(
          data, columns=["query", "target", "similarity", "is_match"]
      )
      return df
  
imports: from abc import ABC
  from typing import Any, Dict, List, Sequence
  import numpy
  from pandas import DataFrame
  from .None import backend
  from .config import get_accelerator
  from .dataclass import ResultCollection
  from .embedder import Embedder
  from .enums import AcceleratorType, IndexerType
  from .indexer import Indexer
  from .types import BatchEmbeddings
label_desc: Use image node_id 7 for calling the UniSim obj's underlying member method code with example usage: obj.match(queries, targets, similarity_threshold) and returns: df