-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from QData/docs
Update Documentation
- Loading branch information
Showing
41 changed files
with
493 additions
and
297 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
Attack Recipes | ||
=============== | ||
|
||
We provide a number of pre-built attack recipes. To run an attack recipe, you can run:: | ||
|
||
python -m textattack --recipe [recipe_name] | ||
|
||
Currently, six main recipes are provided, all of which are synonym substitution based: | ||
|
||
- `Textfooler`_ | ||
- `Textfooler-adjusted`_ | ||
- `Alzantot`_ | ||
- `Alzantot-adjusted`_ | ||
- `DeepWordBug`_ | ||
- `Hotflip`_ | ||
- `Kuleshov`_ | ||
- `Seq2Sick`_ | ||
|
||
Textfooler | ||
########### | ||
|
||
.. automodule:: textattack.attack_recipes.textfooler_jin_2019 | ||
:members: | ||
|
||
Textfooler-adjusted | ||
##################### | ||
|
||
.. automodule:: textattack.attack_recipes.textfooler_jin_2019_adjusted | ||
:members: | ||
|
||
Alzantot | ||
########### | ||
|
||
.. automodule:: textattack.attack_recipes.alzantot_2018 | ||
:members: | ||
|
||
Alzantot-adjusted | ||
################### | ||
|
||
.. automodule:: textattack.attack_recipes.alzantot_2018_adjusted | ||
:members: | ||
|
||
DeepWordBug | ||
############ | ||
|
||
.. automodule:: textattack.attack_recipes.deepwordbug_gao_2018 | ||
:members: | ||
|
||
Hotflip | ||
########### | ||
|
||
.. automodule:: textattack.attack_recipes.hotflip_ebrahimi_2017 | ||
:members: | ||
|
||
|
||
Kuleshov | ||
########### | ||
|
||
.. automodule:: textattack.attack_recipes.kuleshov_2017 | ||
:members: | ||
|
||
|
||
Seq2Sick | ||
########### | ||
|
||
.. automodule:: textattack.attack_recipes.seq2sick_cheng_2018 | ||
:members: |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.. _constraints: | ||
|
||
============= | ||
Constraints | ||
============= | ||
|
||
Constraints determine whether a given transformation is valid. Since transformations may not perfectly preserve syntax of semantics, constraints can increase the likelihood that the resulting transformation preserves these qualities. All constraints are subclasses of the constrain abstract class, documeted here, and must implement at least one of ``__call__`` or ``call_many``. | ||
|
||
We split constraints into three main categories: | ||
|
||
:ref:`semantics`: Check meaning of sentence | ||
|
||
:ref:`syntactical`: Check part-of-speech and grammar | ||
|
||
:ref:`overlap`: Measure edit distance | ||
|
||
.. automodule:: textattack.constraints.constraint | ||
:members: | ||
|
16 changes: 14 additions & 2 deletions
16
docs/contraints/overlap.rst → docs/constraints/overlap.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
.. _overlap: | ||
|
||
========================================== | ||
Constraints based on Syntax and Semantics | ||
Constraints based on Overlap | ||
========================================== | ||
|
||
Overlap constraints determine if a transformation is valid based on character-level analysis. | ||
|
||
Bleu Score | ||
############ | ||
.. automodule:: textattack.constraints.overlap.bleu_score | ||
:members: | ||
|
||
chrF Score | ||
########### | ||
.. automodule:: textattack.constraints.overlap.chrf_score | ||
:members: | ||
|
||
Lenvenshtein Edit Distance | ||
############################ | ||
.. automodule:: textattack.constraints.overlap.levenshtein_edit_distance | ||
:members: | ||
|
||
Meteor Score | ||
############# | ||
.. automodule:: textattack.constraints.overlap.meteor_score | ||
:members: | ||
|
||
.. automodule:: textattack.constraints.overlap.words_perturbed_percentage | ||
Number of Words Perturbed | ||
########################### | ||
.. automodule:: textattack.constraints.overlap.words_perturbed | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.. _syntactical: | ||
|
||
============================== | ||
Constraints based on Syntax | ||
============================== | ||
|
||
Syntactic constraints determine if a transformation is valid based on the resulting syntax. | ||
|
||
Language Models | ||
################ | ||
.. automodule:: textattack.constraints.grammaticality.language_models.language_model_constraint | ||
:members: | ||
|
||
.. automodule:: textattack.constraints.grammaticality.language_models.gpt2 | ||
:members: | ||
|
||
Google Language Models | ||
************************ | ||
.. automodule:: textattack.constraints.grammaticality.language_models.google_language_model.google_language_model | ||
:members: | ||
|
||
.. automodule:: textattack.constraints.grammaticality.language_models.google_language_model.alzantot_goog_lm | ||
:members: | ||
|
||
Language Tool | ||
############## | ||
.. automodule:: textattack.constraints.grammaticality.language_tool | ||
:members: | ||
|
||
Part of Speech | ||
############### | ||
.. automodule:: textattack.constraints.grammaticality.part_of_speech | ||
:members: |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
================= | ||
Datasets | ||
================= | ||
|
||
.. automodule:: textattack.datasets.dataset | ||
:members: | ||
|
||
Classification | ||
############### | ||
.. automodule:: textattack.datasets.classification.classification_dataset | ||
:members: | ||
|
||
.. automodule:: textattack.datasets.classification.ag_news | ||
:members: | ||
|
||
.. automodule:: textattack.datasets.classification.imdb_sentiment | ||
:members: | ||
|
||
.. automodule:: textattack.datasets.classification.kaggle_fake_news | ||
:members: | ||
|
||
.. automodule:: textattack.datasets.classification.movie_review_sentiment | ||
:members: | ||
|
||
.. automodule:: textattack.datasets.classification.yelp_sentiment | ||
:members: | ||
|
||
Entailment | ||
############ | ||
.. automodule.textattack.datasets.entailment.entailment_dataset | ||
.. automodule:: textattack.datasets.entailment.mnli | ||
:members: | ||
|
||
.. automodule:: textattack.datasets.entailment.snli | ||
:members: | ||
|
||
|
||
Translation | ||
############# | ||
.. automodule:: textattack.datasets.translation.translation_datasets | ||
:members: | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.