You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
the return of AttackedText.word_diff_ratio is 1 all the time #787
reason
the type of AttackedText.words is list, when it is use as as input parameter of np.sum() it returns 1or 0 all the time, because it is always consider the first index of the input list
Confirmed and root-caused: self.words != x.words compares two Python lists, which returns a single bool (not an elementwise mask), so the sum was always 0 or 1 regardless of how many words actually differ — your diagnosis about np.sum was on the right track. Fixed in #831 by comparing as numpy arrays. Will close automatically once that merges.
Activity
qiyanjun commentedon Aug 13, 2026
Confirmed and root-caused:
self.words != x.wordscompares two Python lists, which returns a single bool (not an elementwise mask), so the sum was always 0 or 1 regardless of how many words actually differ — your diagnosis aboutnp.sumwas on the right track. Fixed in #831 by comparing as numpy arrays. Will close automatically once that merges.Fix six more bugs from the unresolved-bugs triage list