This repository contains code for the paper "It's Morphin' Time! Combating Linguistic Discrimination with Inflectional Perturbations" (to be presented at ACL 2020).
Authors: Samson Tan, Shafiq Joty, Min-Yen Kan, and Richard Socher
- NLI (MNLI)
- Question Answering (SQuAD 1.1, SQuAD 2)
- Sequence to Sequence (Summarization)
- Easily extendable to Machine Translation with
get_bleufunction
- Easily extendable to Machine Translation with
HuggingFace transformers models!
git clone https://github.com/salesforce/morpheus.git
cd morpheus/morpheus_hf
pip install -r requirements.txt
pip install .
Example:
from morpheus import MorpheusHuggingfaceNLI, MorpheusHuggingfaceQA
test_morph_nli = MorpheusHuggingfaceNLI('textattack/bert-base-uncased-MNLI')
premise = 'However, in the off-field (sentimental) tournament, the Falcons and Jets have more appealing story lines.'.lower()
hypothesis = 'The Jets and Falcons have boring stories.'.lower()
label = 'contradiction'
print(test_morph_nli.morph(premise, hypothesis, label))
@inproceedings{tan-etal-2020-morphin,
title = "It{'}s Morphin{'} Time! {C}ombating Linguistic Discrimination with Inflectional Perturbations",
author = "Tan, Samson and
Joty, Shafiq and
Kan, Min-Yen and
Socher, Richard",
booktitle = "Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics",
month = jul,
year = "2020",
address = "Online",
publisher = "Association for Computational Linguistics",
url = "https://www.aclweb.org/anthology/2020.acl-main.263",
pages = "2920--2935",
}