Skip to content
Prev Previous commit
Next Next commit
Update recipes.py
  • Loading branch information
Hanyu-Liu-123 committed Dec 18, 2020
commit 1909a874ee98f8151ac12e476c72eaddf331ef12
8 changes: 3 additions & 5 deletions textattack/augmentation/recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"""
import random

from textattack.constraints.semantics.sentence_encoders import UniversalSentenceEncoder

from textattack.constraints.pre_transformation import (
RepeatModification,
StopwordModification,
Expand Down Expand Up @@ -37,7 +39,7 @@ class EasyDataAugmenter(Augmenter):

def __init__(self, pct_words_to_swap=0.1, transformations_per_example=4):
assert (
pct_words_to_swap >= 0.0 and pct_words_to_swap <= 1.0
0.0 <= pct_words_to_swap <= 1.0
), "pct_words_to_swap must be in [0., 1.]"
assert (
transformations_per_example > 0
Expand Down Expand Up @@ -204,10 +206,6 @@ def __init__(
):
import transformers

from textattack.constraints.semantics.sentence_encoders import (
UniversalSentenceEncoder,
)

from textattack.transformations import (
CompositeTransformation,
WordInsertionMaskedLM,
Expand Down