class_docstr: A constraint on word substitutions which places a maximum distance
  between the embedding of the word being deleted and the word being
  inserted.
  
  Args:
      embedding (obj): Wrapper for word embedding.
      include_unknown_words (bool): Whether or not the constraint is fulfilled if the embedding of x or x_adv is unknown.
      min_cos_sim (:obj:`float`, optional): The minimum cosine similarity between word embeddings.
      max_mse_dist (:obj:`float`, optional): The maximum euclidean distance between word embeddings.
      cased (bool): Whether embedding supports uppercase & lowercase (defaults to False, or just lowercase).
      compare_against_original (bool):  If `True`, compare new `x_adv` against the original `x`. Otherwise, compare it against the previous `x_adv`.
class_docstr_tok: ["A","constraint","on","word","substitutions","which","places","a","maximum","distance","between","the","embedding","of","the","word","being","deleted","and","the","word","being","inserted",".","Args",":","embedding","(","obj",")",":","Wrapper","for","word","embedding",".","include_unknown_words","(","bool",")",":","Whether","or","not","the","constraint","is","fulfilled","if","the","embedding","of","x","or","x_adv","is","unknown",".","min_cos_sim","(",":","obj",":","`","float","`",",","optional",")",":","The","minimum","cosine","similarity","between","word","embeddings",".","max_mse_dist","(",":","obj",":","`","float","`",",","optional",")",":","The","maximum","euclidean","distance","between","word","embeddings",".","cased","(","bool",")",":","Whether","embedding","supports","uppercase","&","lowercase","(","defaults","to","False",",","or","just","lowercase",")",".","compare_against_original","(","bool",")",":","If","`","True","`",",","compare","new","`","x_adv","`","against","the","original","`","x","`",".","Otherwise",",","compare","it","against","the","previous","`","x_adv","`","."]
code: def __init__(
      self,
      embedding=None,
      include_unknown_words=True,
      min_cos_sim=None,
      max_mse_dist=None,
      cased=False,
      compare_against_original=True,
  ):
      super().__init__(compare_against_original)
      if embedding is None:
          embedding = WordEmbedding.counterfitted_GLOVE_embedding()
      self.include_unknown_words = include_unknown_words
      self.cased = cased
  
      if bool(min_cos_sim) == bool(max_mse_dist):
          raise ValueError(
              "You must choose either `min_cos_sim` or `max_mse_dist`."
          )
      self.min_cos_sim = min_cos_sim
      self.max_mse_dist = max_mse_dist
  
      if not isinstance(embedding, AbstractWordEmbedding):
          raise ValueError(
              "`embedding` object must be of type `textattack.shared.AbstractWordEmbedding`."
          )
      self.embedding = embedding
  
file_path: TextAttack/textattack/constraints/semantics/word_embedding_distance.py
imports: from textattack.constraints import Constraint
  from textattack.shared import AbstractWordEmbedding, WordEmbedding
  from textattack.shared.validators import transformation_consists_of_word_swaps
label_desc: Use image node_id 1 to create a new WordEmbeddingDistance object from inherited base classes: Constraint with example: obj = WordEmbeddingDistance(embedding, include_unknown_words, min_cos_sim, max_mse_dist, cased, compare_against_original)