Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could TextAttack only attack substring of input. #733

Open
ludybupt opened this issue May 9, 2023 · 1 comment
Open

Could TextAttack only attack substring of input. #733

ludybupt opened this issue May 9, 2023 · 1 comment
Labels
question Further information is requested

Comments

@ludybupt
Copy link

ludybupt commented May 9, 2023

I would like to employ TextAttack for further research.
does TextAttack support setting attack range of input text?

@jxmorris12 jxmorris12 added the question Further information is requested label May 10, 2023
@jxmorris12
Copy link
Collaborator

Yes, definitely. You can implement a PreTransformationConstraint that filters out transformations to the words that you don't want to alter. Here's an example, which we used to prevent modifying the premise (or hypothesis) in SNLI: https://github.com/QData/TextAttack/blob/master/textattack/constraints/pre_transformation/input_column_modification.py#L11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants