Skip to content

Commit

Permalink
Merge pull request #98 from QData/docs
Browse files Browse the repository at this point in the history
Update Documentation
  • Loading branch information
jxmorris12 committed May 15, 2020
2 parents f97bfa1 + c9bd457 commit cd28217
Show file tree
Hide file tree
Showing 41 changed files with 493 additions and 297 deletions.
6 changes: 0 additions & 6 deletions docs/attack_methods/attack.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/attack_methods/beam_search.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/attack_methods/genetic_algorithm.rst

This file was deleted.

9 changes: 0 additions & 9 deletions docs/attack_methods/greedy_word_swap.rst

This file was deleted.

9 changes: 0 additions & 9 deletions docs/attack_recipes/alzantot_genetic.rst

This file was deleted.

67 changes: 67 additions & 0 deletions docs/attack_recipes/attack_recipes.rst
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:
6 changes: 0 additions & 6 deletions docs/attack_recipes/gao_deepwordbug.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/attack_recipes/jin_textfooler.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/attack_results/attack_result.rst

This file was deleted.

19 changes: 19 additions & 0 deletions docs/constraints/constraint.rst
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 docs/contraints/overlap.rst → docs/constraints/overlap.rst
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:
24 changes: 14 additions & 10 deletions docs/contraints/semantics.rst → docs/constraints/semantics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,37 @@
Constraints based on Semantics
================================

Semantic constraints determine if a transformation is valid based on similarity of the semantics between the orignal input and the transformed input.

Word Embedding Distance
########################
.. automodule:: textattack.constraints.semantics.word_embedding_distance
:members:

Sentence Encoders
##################

.. automodule:: textattack.constraints.semantics.sentence_encoders.sentence_encoder
:members:

.. automodule:: textattack.constraints.semantics.sentence_encoders.thought_vector
:members:


BERT
*****
.. automodule:: textattack.constraints.semantics.sentence_encoders.bert.bert
:members:

InferSent
***********
.. automodule:: textattack.constraints.semantics.sentence_encoders.infer_sent.infer_sent_model
:members:

.. automodule:: textattack.constraints.semantics.sentence_encoders.infer_sent.infer_sent
:members:

Universal Sentence Encoder
***************************
.. automodule:: textattack.constraints.semantics.sentence_encoders.universal_sentence_encoder.universal_sentence_encoder
:members:


Language Models
################

.. automodule:: textattack.constraints.semantics.language_models.google_language_model.google_language_model
:members:

.. automodule:: textattack.constraints.semantics.language_models.google_language_model.alzantot_goog_lm
:members:
33 changes: 33 additions & 0 deletions docs/constraints/syntax.rst
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:
14 changes: 0 additions & 14 deletions docs/contraints/constraint.rst

This file was deleted.

11 changes: 0 additions & 11 deletions docs/contraints/syntax.rst

This file was deleted.

19 changes: 0 additions & 19 deletions docs/datasets/classification.rst

This file was deleted.

43 changes: 43 additions & 0 deletions docs/datasets/datasets.rst
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:

12 changes: 0 additions & 12 deletions docs/datasets/entailment.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/datasets/generic.rst

This file was deleted.

0 comments on commit cd28217

Please sign in to comment.