# Adaptive Immune-based Sound-Shape Code (ISSC) Subsitution for Adversarial Chinese Text attacks

<!-- *You have to use the special textattack* -->

## Usage

### Attack with our ISSC

You can use `attack.py` to attack as blow:

<pre><code>
python attack.py -s ia -t mix-ssc -n 1000 -m bert-chinanews 
</code></pre>

This will attack BERT model on Chinanews dataset with 1000 examples.

### Attack with baselines

You can attack using the method we replicated, like [Argot](https://www.ijcai.org/Proceedings/2020/351).

<pre><code>
python attack.py -s delete -t argot -n 1000 -m bert-chinanews 
</code></pre>

You can find more details in `transformation` and `search_method` folders.

## Checkpoint 

Each time you run `attack.py`,  your results will automatically save as a `.ckp` file in the `output` document.

