Skip to content

Commit 5fbb076

Browse files
authored
Merge pull request #797 from bterrific2008/augmenter_eda_fix
Fix bug where EDA augmentation recipe would not accept default Augmentation arguments
2 parents ad88963 + 4df80a0 commit 5fbb076

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

textattack/augmentation/recipes.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class EasyDataAugmenter(Augmenter):
3737
https://arxiv.org/abs/1901.11196
3838
"""
3939

40-
def __init__(self, pct_words_to_swap=0.1, transformations_per_example=4):
40+
def __init__(self, pct_words_to_swap=0.1, transformations_per_example=4, **kwargs):
4141
assert 0.0 <= pct_words_to_swap <= 1.0, "pct_words_to_swap must be in [0., 1.]"
4242
assert (
4343
transformations_per_example > 0
@@ -49,17 +49,22 @@ def __init__(self, pct_words_to_swap=0.1, transformations_per_example=4):
4949
self.synonym_replacement = WordNetAugmenter(
5050
pct_words_to_swap=pct_words_to_swap,
5151
transformations_per_example=n_aug_each,
52+
**kwargs,
5253
)
5354
self.random_deletion = DeletionAugmenter(
5455
pct_words_to_swap=pct_words_to_swap,
5556
transformations_per_example=n_aug_each,
57+
**kwargs,
5658
)
5759
self.random_swap = SwapAugmenter(
5860
pct_words_to_swap=pct_words_to_swap,
5961
transformations_per_example=n_aug_each,
62+
**kwargs,
6063
)
6164
self.random_insertion = SynonymInsertionAugmenter(
62-
pct_words_to_swap=pct_words_to_swap, transformations_per_example=n_aug_each
65+
pct_words_to_swap=pct_words_to_swap,
66+
transformations_per_example=n_aug_each,
67+
**kwargs,
6368
)
6469

6570
def augment(self, text):

0 commit comments

Comments
 (0)