class_docstr: Determines if two sentences have a swapped word that has a similar
  probability according to a language model.
  
  Args:
      max_log_prob_diff (float): the maximum decrease in log-probability
          in swapped words from `x` to `x_adv`
      compare_against_original (bool):  If `True`, compare new `x_adv` against the original `x`.
          Otherwise, compare it against the previous `x_adv`.
code: def _check_constraint(self, transformed_text, reference_text):
      try:
          indices = transformed_text.attack_attrs[
              "newly_modified_indices"
          ]
      except KeyError:
          raise KeyError(
              "Cannot apply language model constraint without `newly_modified_indices`"
          )
  
      for i in indices:
          probs = self.get_log_probs_at_index(
              (reference_text, transformed_text), i
          )
          if len(probs) != 2:
              raise ValueError(
                  f"Error: get_log_probs_at_index returned {len(probs)} values for 2 inputs"
              )
          ref_prob, transformed_prob = probs
          if transformed_prob <= ref_prob - self.max_log_prob_diff:
              return False
  
      return True
  
file_path: TextAttack/textattack/constraints/grammaticality/language_models/language_model_constraint.py
imports: from abc import ABC, abstractmethod
  from textattack.constraints import Constraint
label_desc: Use image node_id 3 for calling the LanguageModelConstraint obj's underlying member method code with example usage: obj._check_constraint(transformed_text, reference_text) and returns: True, False