Skip to content

Commit

Permalink
Fix bug where EDA augmentation recipe would not accept default Augmen…
Browse files Browse the repository at this point in the history
…ter arguments
  • Loading branch information
Bryan Tor committed Jul 24, 2024
1 parent ad88963 commit 4df80a0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions textattack/augmentation/recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class EasyDataAugmenter(Augmenter):
https://arxiv.org/abs/1901.11196
"""

def __init__(self, pct_words_to_swap=0.1, transformations_per_example=4):
def __init__(self, pct_words_to_swap=0.1, transformations_per_example=4, **kwargs):
assert 0.0 <= pct_words_to_swap <= 1.0, "pct_words_to_swap must be in [0., 1.]"
assert (
transformations_per_example > 0
Expand All @@ -49,17 +49,22 @@ def __init__(self, pct_words_to_swap=0.1, transformations_per_example=4):
self.synonym_replacement = WordNetAugmenter(
pct_words_to_swap=pct_words_to_swap,
transformations_per_example=n_aug_each,
**kwargs,
)
self.random_deletion = DeletionAugmenter(
pct_words_to_swap=pct_words_to_swap,
transformations_per_example=n_aug_each,
**kwargs,
)
self.random_swap = SwapAugmenter(
pct_words_to_swap=pct_words_to_swap,
transformations_per_example=n_aug_each,
**kwargs,
)
self.random_insertion = SynonymInsertionAugmenter(
pct_words_to_swap=pct_words_to_swap, transformations_per_example=n_aug_each
pct_words_to_swap=pct_words_to_swap,
transformations_per_example=n_aug_each,
**kwargs,
)

def augment(self, text):
Expand Down

0 comments on commit 4df80a0

Please sign in to comment.