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

merge from master

This commit is contained in:
Jin Yong Yoo
2020-07-31 09:34:25 -04:00
51 changed files with 621 additions and 417 deletions

View File

@@ -210,6 +210,16 @@ 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
original_num_texts = len(transformed_texts)
transformed_texts = [
t for t in transformed_texts if t.text != current_text.text
]
if len(transformed_texts) < original_num_texts:
# If this happened, warn the user
utils.logger.warn(
"Warning: transformation returned text with no changes. Skipping."
)
# Populate cache with transformed_texts
uncached_texts = []
for transformed_text in transformed_texts: