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: Encodes a list of sentences.
  
  To be implemented by subclasses.
docstr_tok: ["Encodes","a","list","of","sentences",".","To","be","implemented","by","subclasses","."]
code: def encode(self, sentences):
      """Encodes a list of sentences.
  
      To be implemented by subclasses.
      """
      raise NotImplementedError()
  
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 2 for calling the SentenceEncoder obj's underlying member method code with example usage: obj.encode(sentences) without return types