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

use lambda rather than adding method

This commit is contained in:
uvafan
2020-07-03 16:34:21 -04:00
parent 7cf2128fb2
commit a7ef32773e
2 changed files with 4 additions and 9 deletions

View File

@@ -77,8 +77,10 @@ class Attack:
# Give search method access to functions for getting transformations and evaluating them
self.search_method.get_transformations = self.get_transformations
self.search_method.get_goal_results = (
self.goal_function.get_results_from_search_method
# The search method only needs access to the first argument. The second is only used
# by the attack class when checking whether to skip the sample
self.search_method.get_goal_results = lambda attacked_text_list: self.goal_function.get_results(
attacked_text_list
)
self.search_method.filter_transformations = self.filter_transformations