Skip to content

IndexError when use WordSwapQWERTY to augment data #712

Description

@zzk0

Describe the bug

IndexError when use WordSwapQWERTY to augment data

To Reproduce

The following code would reproduce the issue.

from textattack.transformations.word_swaps import WordSwapQWERTY
from textattack.constraints.pre_transformation import RepeatModification, StopwordModification
from textattack.augmentation import Augmenter


transformation = WordSwapQWERTY()
constraints = [RepeatModification(), StopwordModification()]
augmenter = Augmenter(transformation = transformation, constraints = constraints)
sentence = "This movie is excellent. I found it very interesting. I thought the Wendigo legend was pretty cool. The acting was also great, as well as the costumes, production, photography, directing and script. <br /><br />A very happy family, on vacation gets stranded in the middle of nowhere after they hit a deer. A huntsman then appears and is very angry and outraged over the fact that one of the deer's antler's is broken. He then starts to stalk the family and weird things start to happen to them. <br /><br />See this movie. It's worth it. Kudos to the cast, crew and filmmakers. Two Thumbs Way Up!"
t = augmenter.augment(sentence)
print(t)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions