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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user