mirror of
https://github.com/QData/TextAttack.git
synced 2021-10-13 00:05:06 +03:00
tests pass
This commit is contained in:
@@ -56,7 +56,7 @@ class Attack:
|
||||
self.search_method.get_transformations = self.get_transformations
|
||||
self.search_method.get_goal_results = self.goal_function.get_results
|
||||
|
||||
def get_transformations(self, text, original_text=None):
|
||||
def get_transformations(self, text, original_text=None, **kwargs):
|
||||
"""
|
||||
Applies ``self.transformation`` to ``text``, then filters the list of possible transformations
|
||||
through the applicable constraints.
|
||||
@@ -76,9 +76,7 @@ class Attack:
|
||||
transformations = np.array(self.transformation(text,
|
||||
pre_transformation_constraints=self.pre_transformation_constraints,
|
||||
**kwargs))
|
||||
if apply_constraints:
|
||||
return self._filter_transformations(transformations, text, original_text)
|
||||
return transformations
|
||||
return self._filter_transformations(transformations, text, original_text)
|
||||
|
||||
def _filter_transformations_uncached(self, original_transformations, text, original_text=None):
|
||||
""" Filters a list of potential perturbations based on a list of
|
||||
|
||||
Reference in New Issue
Block a user