mirror of
https://github.com/QData/TextAttack.git
synced 2021-10-13 00:05:06 +03:00
add warning [tests pass]
This commit is contained in:
@@ -165,9 +165,15 @@ class Attack:
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user