1
0
mirror of https://github.com/QData/TextAttack.git synced 2021-10-13 00:05:06 +03:00

automatically remove duplicates returned by transformations

This commit is contained in:
Jack Morris
2020-07-27 11:01:37 -04:00
parent 618e815eea
commit 5cce3918bf

View File

@@ -164,6 +164,10 @@ class Attack:
current_text: The current ``AttackedText`` on which the transformation was applied.
original_text: The original ``AttackedText`` from which the attack started.
"""
# Remove any occurences of current_text in transformed_texts
transformed_texts = [
t for t in transformed_texts if t.text != current_text.text
]
# Populate cache with transformed_texts
uncached_texts = []
for transformed_text in transformed_texts: