Skip to content

AdvAttack/BU-SPO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Semantic-Preserving Adversarial Text Attacks

This repository contains Keras implementations of the paper: Semantic-Preserving Adversarial Text Attacks.

Requirements

  • tensorflow == 1.15.2
  • Keras == 2.2.4
  • spacy == 2.1.4
  • nltk == 3.4.5
  • pandas == 0.23.4
  • OpenHowNet == 0.0.1a8
  • numpy == 1.15.4
  • scikit_learn == 0.21.2
  • If you did not download WordNet before, use nltk.download('wordnet') to do so.(Cancel the code comment on line 20 in BU_SPO_paraphrase. py)

Usage

  • Download IMDB, AG's News and Yahoo! Answer datasets from Google Drive and place them in /data_set.
  • Download glove.6B.100d.txtfrom google drive and place the file in /.
  • Use our pretrained model stored in /runs or train models by running training.py.
  • Run bigram.py to generate bigram candidates or use the prelearnd bigram data in /bigram.
  • To ensure the quick reproducibility, we provide HowNet candidate in google drive. To recalculate the HowNet candidate set, run build_embeddings.py, gen_pos_tag.py, lemma.py and gen_candidates.py under the /hownet_candidates for each dataset.
  • Run BU_SPO_fool.py to generate adversarial examples using BU-MHS.
  • If you want to train or fool different models, reset the argument in training.pyandBU_SPO_fool.py.

Contact

Please contact Xinghao Yang or Wei Liu at firstname.lastname@uts.edu.au if you're interested to collaborate on this research!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages