class_docstr: Constraint using cosine similarity between sentence encodings of x and
  x_adv.
  
  Args:
      threshold (:obj:`float`, optional): The threshold for the constraint to be met.
          Defaults to 0.8
      metric (:obj:`str`, optional): The similarity metric to use. Defaults to
          cosine. Options: ['cosine, 'angular']
      compare_against_original (bool):  If `True`, compare new `x_adv` against the original `x`.
          Otherwise, compare it against the previous `x_adv`.
      window_size (int): The number of words to use in the similarity
          comparison. `None` indicates no windowing (encoding is based on the
          full input).
class_docstr_tok: ["Constraint","using","cosine","similarity","between","sentence","encodings","of","x","and","x_adv",".","Args",":","threshold","(",":","obj",":","`","float","`",",","optional",")",":","The","threshold","for","the","constraint","to","be","met",".","Defaults","to","0.8","metric","(",":","obj",":","`","str","`",",","optional",")",":","The","similarity","metric","to","use",".","Defaults","to","cosine",".","Options",":","[","'cosine",",","'angular","'","]","compare_against_original","(","bool",")",":","If","`","True","`",",","compare","new","`","x_adv","`","against","the","original","`","x","`",".","Otherwise",",","compare","it","against","the","previous","`","x_adv","`",".","window_size","(","int",")",":","The","number","of","words","to","use","in","the","similarity","comparison",".","`","None","`","indicates","no","windowing","(","encoding","is","based","on","the","full","input",")","."]
docstr: Filters the list ``transformed_texts`` so that the similarity
  between the ``reference_text`` and the transformed text is greater than
  the ``self.threshold``.
docstr_tok: ["Filters","the","list","``","transformed_texts","``","so","that","the","similarity","between","the","``","reference_text","``","and","the","transformed","text","is","greater","than","the","``","self.threshold","``","."]
code: def _check_constraint_many(self, transformed_texts, reference_text):
      """Filters the list ``transformed_texts`` so that the similarity
      between the ``reference_text`` and the transformed text is greater than
      the ``self.threshold``."""
      scores = self._score_list(reference_text, transformed_texts)
  
      for i, transformed_text in enumerate(transformed_texts):
          # Optionally ignore similarity score for sentences shorter than the
          # window size.
          if (
              self.skip_text_shorter_than_window
              and len(transformed_text.words) < self.window_size
          ):
              scores[i] = 1
          transformed_text.attack_attrs["similarity_score"] = scores[
              i
          ].item()
      mask = (scores >= self.threshold).cpu().numpy().nonzero()
      return np.array(transformed_texts)[mask]
  
file_path: TextAttack/textattack/constraints/semantics/sentence_encoders/sentence_encoder.py
imports: from abc import ABC
  import math
  import numpy
  import torch
  from textattack.constraints import Constraint
label_desc: Use image node_id 5 for calling the SentenceEncoder obj's underlying member method code with example usage: obj._check_constraint_many(transformed_texts, reference_text) and returns: np