TODO: Code refactoring
Pytorch implementation for ACL 2020 Paper: "Evaluating and Enhancing the Robustness of Neural Network-based Dependency Parsing Models with Adversarial Examples", URL.
You may cite our paper by:
@inproceedings{zheng-etal-2020-evaluating,
title = "Evaluating and Enhancing the Robustness of Neural Network-based Dependency Parsing Models with Adversarial Examples",
author = "Zheng, Xiaoqing and
Zeng, Jiehang and
Zhou, Yi and
Hsieh, Cho-Jui and
Cheng, Minhao and
Huang, Xuanjing",
booktitle = "Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics",
year = "2020",
publisher = "Association for Computational Linguistics"
}
Python: 3.7
PyTorch: 1.4.0
$ python run.py -mode=train -conf=config.iniYou can configure the model in config.ini
$ python run.py -mode=evaluate -conf=config.ini$ python run.py -mode=attack_type -conf=config.iniwhere attack_type includes blackbox, blackbox_phrase, whitebox_phrase
blackbox: black-box on sentence-level attack
blackbox_phrase: black-box on phrase-level attack
whitebox_phrase: white-box on phrase-level attack
$ python run_whitebox.py -mode=hackwhole|hackchar|hacksubtreewhere hackwhole denotes attack a parser at word level, hackchar denotes attack a parser at char level, and hacksubtree denotes attack a subtree in a parser by modifying another one.
The settings for attacking can be found in run_whitebox.py, some basic configuration for the parser can be found in config.ini. If there exists some conflictions, the config in *.py will override that in *.ini.
The implementation is based on yzhangcs's code in biaffine-parser. Thanks for his implementation of "Deep Biaffine Attention for Neural Dependency Parsing".
The nlpaug library is based on makcedward's libary in nlpaug, a python library for data augmentation in NLP. Thanks for their awesome library.