diff --git a/textattack/shared/attacked_text.py b/textattack/shared/attacked_text.py index d2221bb3..132df478 100644 --- a/textattack/shared/attacked_text.py +++ b/textattack/shared/attacked_text.py @@ -483,7 +483,7 @@ def words_diff_ratio(self, x: AttackedText) -> float: Note that current text and `x` must have same number of words. """ assert self.num_words == x.num_words - return float(np.sum(self.words != x.words)) / self.num_words + return float(np.sum(np.array(self.words) != np.array(x.words))) / self.num_words def align_with_model_tokens( self, model_wrapper: textattack.models.wrappers.ModelWrapper