Practical overview
When it fits
Use it when you can supply positive-class text samples and a prediction function, and want to examine classifier behavior under generic text changes without exposing model internals.
Who it is for
- Machine-learning practitioners testing text-classifier robustness against cosmetic text obfuscation.
- Teams preparing training datasets with generated examples resembling text attacks.
Documented uses
- Generate altered versions of positive-class text samples using character- and word-level changes.
- Measure classifier responses to individual and grouped attack types.
- Create adversarial examples for possible dataset augmentation.
Requirements & limits
The repository is public and identifies the project as MIT-licensed. The README documents installation with pip and a TextBlob corpus-download command.
- The attack method uses generic changes and treats the model as a black box.
- The attack interface expects a prediction function that returns a binary label.
- Generated examples may sometimes be identical to their originals.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Generate examples and measure classifier responses
Use the library's documented Python interface to generate altered text and obtain attack metrics for a binary classifier.
Before you start
- Python environment with the Adversary package installed using
pip install Adversary. - TextBlob corpora downloaded with
python -m textblob.download_corpora. - Original positive-class text samples and a prediction function mapping each input string to label 0 or 1.
Steps
Import
Adversaryand create an instance.Pass the original strings to
generateto produce altered text examples.Pass the originals, generated examples, and model prediction function to
attack.
Expected outcome
The generation method returns tuples containing altered text, the applied attacks, and the original-text index; the attack method returns DataFrames with metrics for individual and grouped attacks.
Guide limitations
- Only positive-class instances should be supplied to these functions.
- Probabilistic sampling and length heuristics can produce examples that do not differ from the original.
- The README describes the returned metrics but does not define a specific interpretation threshold.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 15 November 2026
- Original website title
- airbnb/artificial-adversary · Official homepage title · retained in its source language

