1
0
mirror of https://github.com/QData/TextAttack.git synced 2021-10-13 00:05:06 +03:00

a major shift to rst files generated by sphinx-apidoc

major docstring clean up / plus reorganize the folder structure under docs
This commit is contained in:
Yanjun Qi
2020-10-25 20:21:43 -04:00
parent fc7d5294d9
commit 2ea690bbc6
171 changed files with 1042 additions and 852 deletions

1
.gitignore vendored
View File

@@ -16,7 +16,6 @@ outputs/
# Sphinx documentation # Sphinx documentation
docs/_build/ docs/_build/
docs/source/modules.rst
# Packaging # Packaging
*.egg-info/ *.egg-info/

View File

@@ -13,3 +13,4 @@ The ``Attack`` class represents an adversarial attack composed of a goal functio
.. automodule:: textattack.shared.attack .. automodule:: textattack.shared.attack
:members: :members:
:noindex:

View File

@@ -11,7 +11,7 @@ To initialize an attack in Python script, use::
For example, ``attack = InputReductionFeng2018.build(model)`` creates `attack`, an object of type ``Attack`` with the goal function, transformation, constraints, and search method specified in that paper. This object can then be used just like any other attack; for example, by calling ``attack.attack_dataset``. For example, ``attack = InputReductionFeng2018.build(model)`` creates `attack`, an object of type ``Attack`` with the goal function, transformation, constraints, and search method specified in that paper. This object can then be used just like any other attack; for example, by calling ``attack.attack_dataset``.
TextAttack supports the following attack recipes (each recipe's documentation contains a link to the corresponding paper): TextAttack supports the following attack recipes (each recipe's documentation contains a link to the corresponding paper):
.. contents:: :local: .. contents:: :local:
@@ -19,7 +19,7 @@ TextAttack supports the following attack recipes (each recipe's documentation co
Attacks on classification models Attacks on classification models
################################# #################################
Alzantot Genetic Algorithm (Generating Natural Language Adversarial Examples) Alzantot Genetic Algorithm (Generating Natural Language Adversarial Examples)
*********************************************************************************** ***********************************************************************************
@@ -30,79 +30,93 @@ Alzantot Genetic Algorithm (Generating Natural Language Adversarial Examples)
.. automodule:: textattack.attack_recipes.genetic_algorithm_alzantot_2018 .. automodule:: textattack.attack_recipes.genetic_algorithm_alzantot_2018
:members: :members:
:noindex:
Faster Alzantot Genetic Algorithm (Certified Robustness to Adversarial Word Substitutions) Faster Alzantot Genetic Algorithm (Certified Robustness to Adversarial Word Substitutions)
********************************************************************************************** **********************************************************************************************
.. automodule:: textattack.attack_recipes.faster_genetic_algorithm_jia_2019 .. automodule:: textattack.attack_recipes.faster_genetic_algorithm_jia_2019
:members: :members:
:noindex:
BAE (BAE: BERT-Based Adversarial Examples) BAE (BAE: BERT-Based Adversarial Examples)
********************************************* *********************************************
.. automodule:: textattack.attack_recipes.bae_garg_2019 .. automodule:: textattack.attack_recipes.bae_garg_2019
:members: :members:
:noindex:
BERT-Attack: (BERT-Attack: Adversarial Attack Against BERT Using BERT) BERT-Attack: (BERT-Attack: Adversarial Attack Against BERT Using BERT)
************************************************************************* *************************************************************************
.. automodule:: textattack.attack_recipes.bert_attack_li_2020 .. automodule:: textattack.attack_recipes.bert_attack_li_2020
:members: :members:
:noindex:
CheckList: (Beyond Accuracy: Behavioral Testing of NLP models with CheckList) CheckList: (Beyond Accuracy: Behavioral Testing of NLP models with CheckList)
******************************************************************************* *******************************************************************************
.. automodule:: textattack.attack_recipes.checklist_ribeiro_2020 .. automodule:: textattack.attack_recipes.checklist_ribeiro_2020
:members: :members:
:noindex:
DeepWordBug (Black-box Generation of Adversarial Text Sequences to Evade Deep Learning Classifiers) DeepWordBug (Black-box Generation of Adversarial Text Sequences to Evade Deep Learning Classifiers)
****************************************************************************************************** ******************************************************************************************************
.. automodule:: textattack.attack_recipes.deepwordbug_gao_2018 .. automodule:: textattack.attack_recipes.deepwordbug_gao_2018
:members: :members:
:noindex:
HotFlip (HotFlip: White-Box Adversarial Examples for Text Classification) HotFlip (HotFlip: White-Box Adversarial Examples for Text Classification)
****************************************************************************** ******************************************************************************
.. automodule:: textattack.attack_recipes.hotflip_ebrahimi_2017 .. automodule:: textattack.attack_recipes.hotflip_ebrahimi_2017
:members: :members:
:noindex:
Improved Genetic Algorithm (Natural Language Adversarial Attacks and Defenses in Word Level) Improved Genetic Algorithm (Natural Language Adversarial Attacks and Defenses in Word Level)
************************************************************************************************* *************************************************************************************************
.. automodule:: textattack.attack_recipes.iga_wang_2019 .. automodule:: textattack.attack_recipes.iga_wang_2019
:members: :members:
:noindex:
Input Reduction (Pathologies of Neural Models Make Interpretations Difficult) Input Reduction (Pathologies of Neural Models Make Interpretations Difficult)
************************************************************************************ ************************************************************************************
.. automodule:: textattack.attack_recipes.input_reduction_feng_2018 .. automodule:: textattack.attack_recipes.input_reduction_feng_2018
:members: :members:
:noindex:
Kuleshov (Adversarial Examples for Natural Language Classification Problems) Kuleshov (Adversarial Examples for Natural Language Classification Problems)
****************************************************************************** ******************************************************************************
.. automodule:: textattack.attack_recipes.kuleshov_2017 .. automodule:: textattack.attack_recipes.kuleshov_2017
:members: :members:
:noindex:
Particle Swarm Optimization (Word-level Textual Adversarial Attacking as Combinatorial Optimization) Particle Swarm Optimization (Word-level Textual Adversarial Attacking as Combinatorial Optimization)
***************************************************************************************************** *****************************************************************************************************
.. automodule:: textattack.attack_recipes.pso_zang_2020 .. automodule:: textattack.attack_recipes.pso_zang_2020
:members: :members:
:noindex:
PWWS (Generating Natural Language Adversarial Examples through Probability Weighted Word Saliency) PWWS (Generating Natural Language Adversarial Examples through Probability Weighted Word Saliency)
*************************************************************************************************** ***************************************************************************************************
.. automodule:: textattack.attack_recipes.pwws_ren_2019 .. automodule:: textattack.attack_recipes.pwws_ren_2019
:members: :members:
:noindex:
TextFooler (Is BERT Really Robust? A Strong Baseline for Natural Language Attack on Text Classification and Entailment) TextFooler (Is BERT Really Robust? A Strong Baseline for Natural Language Attack on Text Classification and Entailment)
************************************************************************************************************************ ************************************************************************************************************************
.. automodule:: textattack.attack_recipes.textfooler_jin_2019 .. automodule:: textattack.attack_recipes.textfooler_jin_2019
:members: :members:
:noindex:
TextBugger (TextBugger: Generating Adversarial Text Against Real-world Applications) TextBugger (TextBugger: Generating Adversarial Text Against Real-world Applications)
@@ -110,6 +124,7 @@ TextBugger (TextBugger: Generating Adversarial Text Against Real-world Applicati
.. automodule:: textattack.attack_recipes.textbugger_li_2018 .. automodule:: textattack.attack_recipes.textbugger_li_2018
:members: :members:
:noindex:
Attacks on sequence-to-sequence models Attacks on sequence-to-sequence models
############################################ ############################################
@@ -119,12 +134,11 @@ MORPHEUS (Its Morphin Time! Combating Linguistic Discrimination with Infle
.. automodule:: textattack.attack_recipes.morpheus_tan_2020 .. automodule:: textattack.attack_recipes.morpheus_tan_2020
:members: :members:
:noindex:
Seq2Sick (Seq2Sick: Evaluating the Robustness of Sequence-to-Sequence Models with Adversarial Examples) Seq2Sick (Seq2Sick: Evaluating the Robustness of Sequence-to-Sequence Models with Adversarial Examples)
********************************************************************************************************* *********************************************************************************************************
.. automodule:: textattack.attack_recipes.seq2sick_cheng_2018_blackbox .. automodule:: textattack.attack_recipes.seq2sick_cheng_2018_blackbox
:members: :members:
:noindex:

View File

@@ -4,5 +4,6 @@ Augmenter Recipes
Transformations and constraints can be used for simple NLP data augmentations. Here is a list of recipes for NLP data augmentations Transformations and constraints can be used for simple NLP data augmentations. Here is a list of recipes for NLP data augmentations
.. automodule:: textattack.augmentation.recipes .. automodule:: textattack.augmentation.recipes
:members: :members:
:noindex:

View File

@@ -22,6 +22,8 @@ A fourth type of constraint restricts the search method from exploring certain p
:special-members: __call__ :special-members: __call__
:private-members: :private-members:
:members: :members:
:noindex:
.. _semantics: .. _semantics:
@@ -35,64 +37,77 @@ Word Embedding Distance
######################## ########################
.. automodule:: textattack.constraints.semantics.word_embedding_distance .. automodule:: textattack.constraints.semantics.word_embedding_distance
:members: :members:
:noindex:
Sentence Encoders Sentence Encoders
################## ##################
.. automodule:: textattack.constraints.semantics.sentence_encoders.sentence_encoder .. automodule:: textattack.constraints.semantics.sentence_encoders.sentence_encoder
:members: :members:
:noindex:
Thought Vectors Thought Vectors
**************** ****************
.. automodule:: textattack.constraints.semantics.sentence_encoders.thought_vector .. automodule:: textattack.constraints.semantics.sentence_encoders.thought_vector
:members: :members:
:noindex:
BERT BERT
***** *****
.. automodule:: textattack.constraints.semantics.sentence_encoders.bert.bert .. automodule:: textattack.constraints.semantics.sentence_encoders.bert.bert
:members: :members:
:noindex:
InferSent InferSent
*********** ***********
.. automodule:: textattack.constraints.semantics.sentence_encoders.infer_sent.infer_sent_model .. automodule:: textattack.constraints.semantics.sentence_encoders.infer_sent.infer_sent_model
:members: :members:
:noindex:
.. automodule:: textattack.constraints.semantics.sentence_encoders.infer_sent.infer_sent .. automodule:: textattack.constraints.semantics.sentence_encoders.infer_sent.infer_sent
:members: :members:
:noindex:
Universal Sentence Encoder Universal Sentence Encoder
*************************** ***************************
.. automodule:: textattack.constraints.semantics.sentence_encoders.universal_sentence_encoder.universal_sentence_encoder .. automodule:: textattack.constraints.semantics.sentence_encoders.universal_sentence_encoder.universal_sentence_encoder
:members: :members:
:noindex:
Multilingual Universal Sentence Encoder Multilingual Universal Sentence Encoder
***************************************** *****************************************
.. automodule:: textattack.constraints.semantics.sentence_encoders.universal_sentence_encoder.multilingual_universal_sentence_encoder .. automodule:: textattack.constraints.semantics.sentence_encoders.universal_sentence_encoder.multilingual_universal_sentence_encoder
:members: :members:
:noindex:
.. _grammaticality: .. _grammaticality:
Grammaticality Grammaticality
----------------- -----------------
Grammaticality constraints determine if a transformation is valid based on Grammaticality constraints determine if a transformation is valid based on syntactic properties of the perturbation.
syntactic properties of the perturbation.
Language Models Language Models
################ ################
.. automodule:: textattack.constraints.grammaticality.language_models.language_model_constraint .. automodule:: textattack.constraints.grammaticality.language_models.language_model_constraint
:members: :members:
:noindex:
GPT-2 GPT-2
******* *******
.. automodule:: textattack.constraints.grammaticality.language_models.gpt2 .. automodule:: textattack.constraints.grammaticality.language_models.gpt2
:members: :members:
:noindex:
"Learning To Write" Language Model "Learning To Write" Language Model
************************************ ************************************
.. automodule:: textattack.constraints.grammaticality.language_models.learning_to_write.learning_to_write .. automodule:: textattack.constraints.grammaticality.language_models.learning_to_write.learning_to_write
:members: :members:
:noindex:
Google 1-Billion Words Language Model Google 1-Billion Words Language Model
@@ -100,21 +115,25 @@ Google 1-Billion Words Language Model
.. automodule:: textattack.constraints.grammaticality.language_models.google_language_model.google_language_model .. automodule:: textattack.constraints.grammaticality.language_models.google_language_model.google_language_model
:members: :members:
:noindex:
LanguageTool Grammar Checker LanguageTool Grammar Checker
############################## ##############################
.. automodule:: textattack.constraints.grammaticality.language_tool .. automodule:: textattack.constraints.grammaticality.language_tool
:members: :members:
:noindex:
Part of Speech Part of Speech
############### ###############
.. automodule:: textattack.constraints.grammaticality.part_of_speech .. automodule:: textattack.constraints.grammaticality.part_of_speech
:members: :members:
:noindex:
CoLA CoLA
###### ######
.. automodule:: textattack.constraints.grammaticality.cola .. automodule:: textattack.constraints.grammaticality.cola
:members: :members:
:noindex:
.. _overlap: .. _overlap:
@@ -127,26 +146,31 @@ BLEU Score
############ ############
.. automodule:: textattack.constraints.overlap.bleu_score .. automodule:: textattack.constraints.overlap.bleu_score
:members: :members:
:noindex:
chrF Score chrF Score
########### ###########
.. automodule:: textattack.constraints.overlap.chrf_score .. automodule:: textattack.constraints.overlap.chrf_score
:members: :members:
:noindex:
Lenvenshtein Edit Distance Lenvenshtein Edit Distance
############################ ############################
.. automodule:: textattack.constraints.overlap.levenshtein_edit_distance .. automodule:: textattack.constraints.overlap.levenshtein_edit_distance
:members: :members:
:noindex:
METEOR Score METEOR Score
############# #############
.. automodule:: textattack.constraints.overlap.meteor_score .. automodule:: textattack.constraints.overlap.meteor_score
:members: :members:
:noindex:
Maximum Words Perturbed Maximum Words Perturbed
########################### ###########################
.. automodule:: textattack.constraints.overlap.max_words_perturbed .. automodule:: textattack.constraints.overlap.max_words_perturbed
:members: :members:
:noindex:
.. _pre_transformation: .. _pre_transformation:
@@ -165,23 +189,28 @@ Pre-Transformation Constraint
:special-members: __call__ :special-members: __call__
:private-members: :private-members:
:members: :members:
:noindex:
Stopword Modification Stopword Modification
######################## ########################
.. automodule:: textattack.constraints.pre_transformation.stopword_modification .. automodule:: textattack.constraints.pre_transformation.stopword_modification
:members: :members:
:noindex:
Repeat Modification Repeat Modification
######################## ########################
.. automodule:: textattack.constraints.pre_transformation.repeat_modification .. automodule:: textattack.constraints.pre_transformation.repeat_modification
:members: :members:
:noindex:
Input Column Modification Input Column Modification
############################# #############################
.. automodule:: textattack.constraints.pre_transformation.input_column_modification .. automodule:: textattack.constraints.pre_transformation.input_column_modification
:members: :members:
:noindex:
Max Word Index Modification Max Word Index Modification
############################### ###############################
.. automodule:: textattack.constraints.pre_transformation.max_word_index_modification .. automodule:: textattack.constraints.pre_transformation.max_word_index_modification
:members: :members:
:noindex:

View File

@@ -8,23 +8,30 @@ Goal functions determine if an attack has been successful.
.. automodule:: textattack.goal_functions.goal_function .. automodule:: textattack.goal_functions.goal_function
:members: :members:
:noindex:
:private-members: :private-members:
Classification Classification
################ ################
.. automodule:: textattack.goal_functions.classification.classification_goal_function .. automodule:: textattack.goal_functions.classification.classification_goal_function
:members: :members:
:noindex:
.. automodule:: textattack.goal_functions.classification.targeted_classification .. automodule:: textattack.goal_functions.classification.targeted_classification
:members: :members:
:noindex:
.. automodule:: textattack.goal_functions.classification.untargeted_classification .. automodule:: textattack.goal_functions.classification.untargeted_classification
:members: :members:
:noindex:
Text to Text Text to Text
############## ##############
.. automodule:: textattack.goal_functions.text.text_to_text_goal_function .. automodule:: textattack.goal_functions.text.text_to_text_goal_function
:members: :members:
:noindex:
.. automodule:: textattack.goal_functions.text.non_overlapping_output .. automodule:: textattack.goal_functions.text.non_overlapping_output
:members: :members:
:noindex:

View File

@@ -0,0 +1,7 @@
Important APIs
===============
.. toctree::
:glob:
*

View File

@@ -6,3 +6,4 @@ The ``Checkpoint`` class saves in-progress attacks and loads saved attacks from
.. automodule:: textattack.shared.checkpoint .. automodule:: textattack.shared.checkpoint
:members: :members:
:noindex:

View File

@@ -3,10 +3,6 @@ Models
======================== ========================
Models User-specified
--------------------------
TextAttack allows users to provide their own models for testing. Models can be loaded in three ways: TextAttack allows users to provide their own models for testing. Models can be loaded in three ways:
1. ``--model`` for pre-trained models and models trained with TextAttack 1. ``--model`` for pre-trained models and models trained with TextAttack
@@ -14,32 +10,38 @@ TextAttack allows users to provide their own models for testing. Models can be l
3. ``--model-from-file`` which will dynamically load a Python file and look for the ``model`` variable 3. ``--model-from-file`` which will dynamically load a Python file and look for the ``model`` variable
Model Wrappers Model Wrappers
************************* --------------------------
TextAttack can attack any model that takes a list of strings as input and outputs a list of predictions. This is the idea behind *model wrappers*: to help your model conform to this API, we've provided the ``textattack.models.wrappers.ModelWrapper`` abstract class. TextAttack can attack any model that takes a list of strings as input and outputs a list of predictions. This is the idea behind *model wrappers*: to help your model conform to this API, we've provided the ``textattack.models.wrappers.ModelWrapper`` abstract class.
.. automodule:: textattack.models.wrappers.model_wrapper .. automodule:: textattack.models.wrappers.model_wrapper
:members: :members:
:noindex:
Models User-specified
--------------------------
We've also provided implementations of model wrappers for common patterns in some popular machine learning frameworks: We've also provided implementations of model wrappers for common patterns in some popular machine learning frameworks:
.. automodule:: textattack.models.wrappers.pytorch_model_wrapper .. automodule:: textattack.models.wrappers.pytorch_model_wrapper
:members: :members:
:noindex:
.. automodule:: textattack.models.wrappers.tensorflow_model_wrapper .. automodule:: textattack.models.wrappers.tensorflow_model_wrapper
:members: :members:
:noindex:
.. automodule:: textattack.models.wrappers.sklearn_model_wrapper .. automodule:: textattack.models.wrappers.sklearn_model_wrapper
:members: :members:
:noindex:
.. automodule:: textattack.models.wrappers.huggingface_model_wrapper .. automodule:: textattack.models.wrappers.huggingface_model_wrapper
:members: :members:
:noindex:
Models Pre-trained Models Pre-trained
-------------------------- --------------------------
TextAttack also provides lots of pre-trained models for common tasks. Testing different attacks on the same model ensures attack comparisons are fair. TextAttack also provides lots of pre-trained models for common tasks. Testing different attacks on the same model ensures attack comparisons are fair.
Any of these models can be provided to ``textattack attack`` via ``--model``, for example, ``--model bert-base-uncased-mr``. For a full list of pre-trained models, see the `pre-trained models README <https://github.com/QData/TextAttack/tree/master/textattack/models>`_. Any of these models can be provided to ``textattack attack`` via ``--model``, for example, ``--model bert-base-uncased-mr``. For a full list of pre-trained models, see the `pre-trained models README <https://github.com/QData/TextAttack/tree/master/textattack/models>`_.

View File

@@ -1,6 +1,6 @@
===================== =========================
Search Methods Important Search Methods
===================== =========================
Search methods explore the transformation space in an attempt to find a successful attack as determined by a :ref:`goal_function` and list of :ref:`constraint`\s. Search methods explore the transformation space in an attempt to find a successful attack as determined by a :ref:`goal_function` and list of :ref:`constraint`\s.
@@ -8,18 +8,21 @@ Search methods explore the transformation space in an attempt to find a successf
:special-members: __call__ :special-members: __call__
:private-members: :private-members:
:members: :members:
:noindex:
Greedy Search Greedy Search
#################### ####################
.. automodule:: textattack.search_methods.greedy_search .. automodule:: textattack.search_methods.greedy_search
:members: :members:
:noindex:
Beam Search Beam Search
############ ############
.. automodule:: textattack.search_methods.beam_search .. automodule:: textattack.search_methods.beam_search
:members: :members:
:noindex:
Greedy Word Swap with Word Importance Ranking Greedy Word Swap with Word Importance Ranking
@@ -27,15 +30,18 @@ Greedy Word Swap with Word Importance Ranking
.. automodule:: textattack.search_methods.greedy_word_swap_wir .. automodule:: textattack.search_methods.greedy_word_swap_wir
:members: :members:
:noindex:
Genetic Algorithm Word Swap Genetic Algorithm Word Swap
########################### ###########################
.. automodule:: textattack.search_methods.genetic_algorithm .. automodule:: textattack.search_methods.genetic_algorithm
:members: :members:
:noindex:
Particle Swarm Optimization Particle Swarm Optimization
############################## ##############################
.. automodule:: textattack.search_methods.particle_swarm_optimization .. automodule:: textattack.search_methods.particle_swarm_optimization
:members: :members:
:noindex:

View File

@@ -1,5 +1,5 @@
========================== ==========================
Transformations Important Transformations
========================== ==========================
A transformation is a method which perturbs a text input through the insertion, deletion and substiution of words, characters, and phrases. All transformations take a ``TokenizedText`` as input and return a list of ``TokenizedText``\s that contains possible transformations. Every transformation is a subclass of the abstract ``Transformation`` class. A transformation is a method which perturbs a text input through the insertion, deletion and substiution of words, characters, and phrases. All transformations take a ``TokenizedText`` as input and return a list of ``TokenizedText``\s that contains possible transformations. Every transformation is a subclass of the abstract ``Transformation`` class.
@@ -8,7 +8,7 @@ A transformation is a method which perturbs a text input through the insertion,
:special-members: __call__ :special-members: __call__
:private-members: :private-members:
:members: :members:
:noindex:
Composite Transformation Composite Transformation
-------------------------- --------------------------
@@ -16,6 +16,7 @@ Multiple transformations can be used by providing a list of ``Transformation``\s
.. automodule:: textattack.transformations.composite_transformation .. automodule:: textattack.transformations.composite_transformation
:members: :members:
:noindex:
Word Swap Word Swap
----------------- -----------------
@@ -24,6 +25,7 @@ Word swap transformations act by replacing some words in the input. Subclasses c
.. automodule:: textattack.transformations.word_swap .. automodule:: textattack.transformations.word_swap
:private-members: :private-members:
:members: :members:
:noindex:
Word Swap by Embedding Word Swap by Embedding
@@ -31,75 +33,91 @@ Word Swap by Embedding
.. automodule:: textattack.transformations.word_swap_embedding .. automodule:: textattack.transformations.word_swap_embedding
:members: :members:
:noindex:
Word Swap by WordNet Word Replacement Word Swap by WordNet Word Replacement
--------------------------------------- ---------------------------------------
.. automodule:: textattack.transformations.word_swap_wordnet .. automodule:: textattack.transformations.word_swap_wordnet
:members: :members:
:noindex:
Word Swap by Gradient Word Swap by Gradient
--------------------------------------- ---------------------------------------
.. automodule:: textattack.transformations.word_swap_gradient_based .. automodule:: textattack.transformations.word_swap_gradient_based
:members: :members:
:noindex:
Word Swap by Homoglyph Word Swap by Homoglyph
---------------------- ----------------------
.. automodule:: textattack.transformations.word_swap_homoglyph_swap .. automodule:: textattack.transformations.word_swap_homoglyph_swap
:members: :members:
:noindex:
Word Swap by Neighboring Character Swap Word Swap by Neighboring Character Swap
--------------------------------------- ---------------------------------------
.. automodule:: textattack.transformations.word_swap_neighboring_character_swap
:members: :members:
:noindex:
Word Swap by Random Character Deletion Word Swap by Random Character Deletion
--------------------------------------- ---------------------------------------
.. automodule:: textattack.transformations.word_swap_random_character_deletion .. automodule:: textattack.transformations.word_swap_random_character_deletion
:members: :members:
:noindex:
Word Swap by Random Character Insertion Word Swap by Random Character Insertion
--------------------------------------- ---------------------------------------
.. automodule:: textattack.transformations.word_swap_random_character_insertion .. automodule:: textattack.transformations.word_swap_random_character_insertion
:members: :members:
:noindex:
Word Swap by Random Character Substitution Word Swap by Random Character Substitution
------------------------------------------- -------------------------------------------
.. automodule:: textattack.transformations.word_swap_random_character_substitution .. automodule:: textattack.transformations.word_swap_random_character_substitution
:members: :members:
:noindex:
Word Swap by Changing Location Word Swap by Changing Location
------------------------------- -------------------------------
.. automodule:: textattack.transformations.word_swap_change_location .. automodule:: textattack.transformations.word_swap_change_location
:members: :members:
:noindex:
Word Swap by Changing Number Word Swap by Changing Number
------------------------------- -------------------------------
.. automodule:: textattack.transformations.word_swap_change_number .. automodule:: textattack.transformations.word_swap_change_number
:members: :members:
:noindex:
Word Swap by Changing Name Word Swap by Changing Name
------------------------------- -------------------------------
.. automodule:: textattack.transformations.word_swap_change_name .. automodule:: textattack.transformations.word_swap_change_name
:members: :members:
:noindex:
Word Swap by Contraction Word Swap by Contraction
------------------------------- -------------------------------
.. automodule:: textattack.transformations.word_swap_contract .. automodule:: textattack.transformations.word_swap_contract
:members: :members:
:noindex:
Word Swap by Extension Word Swap by Extension
------------------------------- -------------------------------
.. automodule:: textattack.transformations.word_swap_extend .. automodule:: textattack.transformations.word_swap_extend
:members: :members:
:noindex:

View File

@@ -1,6 +1,9 @@
# Minimal makefile for Sphinx documentation # Minimal makefile for Sphinx documentation
# #
# First run "sphinx-apidoc -f -o apidoc -d 6 -E -T -M ../textattack"
# Then run "make html"
# You can set these variables from the command line, and also # You can set these variables from the command line, and also
# from the environment for the first two. # from the environment for the first two.
SPHINXOPTS ?= SPHINXOPTS ?=

View File

@@ -1,23 +0,0 @@
===================
Attack Result
===================
The result of an attack's attempt to find a successful adversarial perturbation.
.. automodule:: textattack.attack_results.attack_result
:members:
.. automodule:: textattack.attack_results.successful_attack_result
:members:
.. automodule:: textattack.attack_results.failed_attack_result
:members:
.. automodule:: textattack.attack_results.skipped_attack_result
:members:

View File

@@ -1,6 +0,0 @@
===================
Attacked Text
===================
.. automodule:: textattack.shared.attacked_text
:members:

View File

@@ -1,11 +0,0 @@
======================
Augmenter
======================
Transformations and constraints can be used outside of an attack for simple NLP data augmentation with the ``Augmenter`` class that returns all possible transformations for a given string.
.. automodule:: textattack.augmentation.augmenter
:members:
:exclude-members: DummyTokenizer

View File

@@ -1,22 +0,0 @@
======================
datasets
======================
TextAttack allows users to provide their own dataset or load from HuggingFace.
textattack.datasets.dataset module
----------------------------------
.. automodule:: textattack.datasets.dataset
:members:
:undoc-members:
:show-inheritance:
textattack.datasets.huggingface\_dataset module
-----------------------------------------------
.. automodule:: textattack.datasets.huggingface_dataset
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,14 +0,0 @@
=======================
Goal Function Result
=======================
Goal function results report the result of a goal function evaluation, indicating whether an attack succeeded for a given example.
.. automodule:: textattack.goal_function_results.goal_function_result
:members:
.. automodule:: textattack.goal_function_results.classification_goal_function_result
:members:
.. automodule:: textattack.goal_function_results.text_to_text_goal_function_result
:members:

View File

@@ -1,8 +0,0 @@
Selected API References
========================
.. toctree::
:glob:
:titlesonly:
*

View File

@@ -1,29 +0,0 @@
======================
Misc Loggers
======================
Loggers track, visualize, and export attack results.
.. automodule:: textattack.loggers.logger
:members:
Loggers
########
.. automodule:: textattack.loggers.file_logger
:members:
.. automodule:: textattack.loggers.csv_logger
:members:
.. automodule:: textattack.loggers.visdom_logger
:members:
.. automodule:: textattack.loggers.weights_and_biases_logger
:members:
Log Manager
############
.. automodule:: textattack.loggers.attack_log_manager
:members:

View File

@@ -1,8 +0,0 @@
======================
Misc Validators
======================
Validators ensure compatibility between search methods, transformations, constraints, and goal functions.
.. automodule:: textattack.shared.validators
:members:

View File

@@ -1,157 +1,118 @@
textattack.attack\_recipes package textattack.attack\_recipes package
================================== ==================================
.. automodule:: textattack.attack_recipes
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.attack\_recipes.attack\_recipe module
------------------------------------------------
.. automodule:: textattack.attack_recipes.attack_recipe .. automodule:: textattack.attack_recipes.attack_recipe
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_recipes.bae\_garg\_2019 module
-------------------------------------------------
.. automodule:: textattack.attack_recipes.bae_garg_2019 .. automodule:: textattack.attack_recipes.bae_garg_2019
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_recipes.bert\_attack\_li\_2020 module
--------------------------------------------------------
.. automodule:: textattack.attack_recipes.bert_attack_li_2020 .. automodule:: textattack.attack_recipes.bert_attack_li_2020
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_recipes.checklist\_ribeiro\_2020 module
----------------------------------------------------------
.. automodule:: textattack.attack_recipes.checklist_ribeiro_2020 .. automodule:: textattack.attack_recipes.checklist_ribeiro_2020
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_recipes.deepwordbug\_gao\_2018 module
--------------------------------------------------------
.. automodule:: textattack.attack_recipes.deepwordbug_gao_2018 .. automodule:: textattack.attack_recipes.deepwordbug_gao_2018
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_recipes.faster\_genetic\_algorithm\_jia\_2019 module
-----------------------------------------------------------------------
.. automodule:: textattack.attack_recipes.faster_genetic_algorithm_jia_2019 .. automodule:: textattack.attack_recipes.faster_genetic_algorithm_jia_2019
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_recipes.genetic\_algorithm\_alzantot\_2018 module
--------------------------------------------------------------------
.. automodule:: textattack.attack_recipes.genetic_algorithm_alzantot_2018 .. automodule:: textattack.attack_recipes.genetic_algorithm_alzantot_2018
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_recipes.hotflip\_ebrahimi\_2017 module
---------------------------------------------------------
.. automodule:: textattack.attack_recipes.hotflip_ebrahimi_2017 .. automodule:: textattack.attack_recipes.hotflip_ebrahimi_2017
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_recipes.iga\_wang\_2019 module
-------------------------------------------------
.. automodule:: textattack.attack_recipes.iga_wang_2019 .. automodule:: textattack.attack_recipes.iga_wang_2019
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_recipes.input\_reduction\_feng\_2018 module
--------------------------------------------------------------
.. automodule:: textattack.attack_recipes.input_reduction_feng_2018 .. automodule:: textattack.attack_recipes.input_reduction_feng_2018
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_recipes.kuleshov\_2017 module
------------------------------------------------
.. automodule:: textattack.attack_recipes.kuleshov_2017 .. automodule:: textattack.attack_recipes.kuleshov_2017
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_recipes.morpheus\_tan\_2020 module
-----------------------------------------------------
.. automodule:: textattack.attack_recipes.morpheus_tan_2020 .. automodule:: textattack.attack_recipes.morpheus_tan_2020
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_recipes.pruthi\_2019 module
----------------------------------------------
.. automodule:: textattack.attack_recipes.pruthi_2019 .. automodule:: textattack.attack_recipes.pruthi_2019
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_recipes.pso\_zang\_2020 module
-------------------------------------------------
.. automodule:: textattack.attack_recipes.pso_zang_2020 .. automodule:: textattack.attack_recipes.pso_zang_2020
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_recipes.pwws\_ren\_2019 module
-------------------------------------------------
.. automodule:: textattack.attack_recipes.pwws_ren_2019 .. automodule:: textattack.attack_recipes.pwws_ren_2019
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_recipes.seq2sick\_cheng\_2018\_blackbox module
-----------------------------------------------------------------
.. automodule:: textattack.attack_recipes.seq2sick_cheng_2018_blackbox .. automodule:: textattack.attack_recipes.seq2sick_cheng_2018_blackbox
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_recipes.textbugger\_li\_2018 module
------------------------------------------------------
.. automodule:: textattack.attack_recipes.textbugger_li_2018 .. automodule:: textattack.attack_recipes.textbugger_li_2018
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_recipes.textfooler\_jin\_2019 module
-------------------------------------------------------
.. automodule:: textattack.attack_recipes.textfooler_jin_2019 .. automodule:: textattack.attack_recipes.textfooler_jin_2019
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.attack_recipes
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,53 +1,40 @@
textattack.attack\_results package textattack.attack\_results package
================================== ==================================
.. automodule:: textattack.attack_results
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.attack\_results.attack\_result module
------------------------------------------------
.. automodule:: textattack.attack_results.attack_result .. automodule:: textattack.attack_results.attack_result
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_results.failed\_attack\_result module
--------------------------------------------------------
.. automodule:: textattack.attack_results.failed_attack_result .. automodule:: textattack.attack_results.failed_attack_result
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_results.maximized\_attack\_result module
-----------------------------------------------------------
.. automodule:: textattack.attack_results.maximized_attack_result .. automodule:: textattack.attack_results.maximized_attack_result
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_results.skipped\_attack\_result module
---------------------------------------------------------
.. automodule:: textattack.attack_results.skipped_attack_result .. automodule:: textattack.attack_results.skipped_attack_result
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.attack\_results.successful\_attack\_result module
------------------------------------------------------------
.. automodule:: textattack.attack_results.successful_attack_result .. automodule:: textattack.attack_results.successful_attack_result
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.attack_results
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,29 +1,22 @@
textattack.augmentation package textattack.augmentation package
=============================== ===============================
.. automodule:: textattack.augmentation
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.augmentation.augmenter module
----------------------------------------
.. automodule:: textattack.augmentation.augmenter .. automodule:: textattack.augmentation.augmenter
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.augmentation.recipes module
--------------------------------------
.. automodule:: textattack.augmentation.recipes .. automodule:: textattack.augmentation.recipes
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.augmentation
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,61 +1,46 @@
textattack.commands.attack package textattack.commands.attack package
================================== ==================================
.. automodule:: textattack.commands.attack
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.commands.attack.attack\_args module
----------------------------------------------
.. automodule:: textattack.commands.attack.attack_args .. automodule:: textattack.commands.attack.attack_args
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.commands.attack.attack\_args\_helpers module
-------------------------------------------------------
.. automodule:: textattack.commands.attack.attack_args_helpers .. automodule:: textattack.commands.attack.attack_args_helpers
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.commands.attack.attack\_command module
-------------------------------------------------
.. automodule:: textattack.commands.attack.attack_command .. automodule:: textattack.commands.attack.attack_command
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.commands.attack.attack\_resume\_command module
---------------------------------------------------------
.. automodule:: textattack.commands.attack.attack_resume_command .. automodule:: textattack.commands.attack.attack_resume_command
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.commands.attack.run\_attack\_parallel module
-------------------------------------------------------
.. automodule:: textattack.commands.attack.run_attack_parallel .. automodule:: textattack.commands.attack.run_attack_parallel
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.commands.attack.run\_attack\_single\_threaded module
---------------------------------------------------------------
.. automodule:: textattack.commands.attack.run_attack_single_threaded .. automodule:: textattack.commands.attack.run_attack_single_threaded
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.commands.attack
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,21 +1,16 @@
textattack.commands.eval\_model package textattack.commands.eval\_model package
======================================= =======================================
Submodules
----------
textattack.commands.eval\_model.eval\_model\_command module
-----------------------------------------------------------
.. automodule:: textattack.commands.eval_model.eval_model_command
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: textattack.commands.eval_model .. automodule:: textattack.commands.eval_model
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Submodules
----------
.. automodule:: textattack.commands.eval_model.eval_model_command
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,11 +1,16 @@
textattack.commands package textattack.commands package
=========================== ===========================
.. automodule:: textattack.commands
:members:
:undoc-members:
:show-inheritance:
Subpackages Subpackages
----------- -----------
.. toctree:: .. toctree::
:maxdepth: 4 :maxdepth: 6
textattack.commands.attack textattack.commands.attack
textattack.commands.eval_model textattack.commands.eval_model
@@ -14,58 +19,38 @@ Subpackages
Submodules Submodules
---------- ----------
textattack.commands.augment module
----------------------------------
.. automodule:: textattack.commands.augment .. automodule:: textattack.commands.augment
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.commands.benchmark\_recipe module
--------------------------------------------
.. automodule:: textattack.commands.benchmark_recipe .. automodule:: textattack.commands.benchmark_recipe
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.commands.list\_things module
---------------------------------------
.. automodule:: textattack.commands.list_things .. automodule:: textattack.commands.list_things
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.commands.peek\_dataset module
----------------------------------------
.. automodule:: textattack.commands.peek_dataset .. automodule:: textattack.commands.peek_dataset
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.commands.textattack\_cli module
------------------------------------------
.. automodule:: textattack.commands.textattack_cli .. automodule:: textattack.commands.textattack_cli
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.commands.textattack\_command module
----------------------------------------------
.. automodule:: textattack.commands.textattack_command .. automodule:: textattack.commands.textattack_command
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.commands
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,37 +1,28 @@
textattack.commands.train\_model package textattack.commands.train\_model package
======================================== ========================================
.. automodule:: textattack.commands.train_model
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.commands.train\_model.run\_training module
-----------------------------------------------------
.. automodule:: textattack.commands.train_model.run_training .. automodule:: textattack.commands.train_model.run_training
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.commands.train\_model.train\_args\_helpers module
------------------------------------------------------------
.. automodule:: textattack.commands.train_model.train_args_helpers .. automodule:: textattack.commands.train_model.train_args_helpers
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.commands.train\_model.train\_model\_command module
-------------------------------------------------------------
.. automodule:: textattack.commands.train_model.train_model_command .. automodule:: textattack.commands.train_model.train_model_command
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.commands.train_model
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,45 +1,34 @@
textattack.constraints.grammaticality.language\_models.google\_language\_model package textattack.constraints.grammaticality.language\_models.google\_language\_model package
====================================================================================== ======================================================================================
.. automodule:: textattack.constraints.grammaticality.language_models.google_language_model
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.constraints.grammaticality.language\_models.google\_language\_model.alzantot\_goog\_lm module
--------------------------------------------------------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.language_models.google_language_model.alzantot_goog_lm .. automodule:: textattack.constraints.grammaticality.language_models.google_language_model.alzantot_goog_lm
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.grammaticality.language\_models.google\_language\_model.google\_language\_model module
-------------------------------------------------------------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.language_models.google_language_model.google_language_model .. automodule:: textattack.constraints.grammaticality.language_models.google_language_model.google_language_model
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.grammaticality.language\_models.google\_language\_model.lm\_data\_utils module
-----------------------------------------------------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.language_models.google_language_model.lm_data_utils .. automodule:: textattack.constraints.grammaticality.language_models.google_language_model.lm_data_utils
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.grammaticality.language\_models.google\_language\_model.lm\_utils module
-----------------------------------------------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.language_models.google_language_model.lm_utils .. automodule:: textattack.constraints.grammaticality.language_models.google_language_model.lm_utils
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.constraints.grammaticality.language_models.google_language_model
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,45 +1,34 @@
textattack.constraints.grammaticality.language\_models.learning\_to\_write package textattack.constraints.grammaticality.language\_models.learning\_to\_write package
================================================================================== ==================================================================================
.. automodule:: textattack.constraints.grammaticality.language_models.learning_to_write
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.constraints.grammaticality.language\_models.learning\_to\_write.adaptive\_softmax module
---------------------------------------------------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.language_models.learning_to_write.adaptive_softmax .. automodule:: textattack.constraints.grammaticality.language_models.learning_to_write.adaptive_softmax
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.grammaticality.language\_models.learning\_to\_write.language\_model\_helpers module
----------------------------------------------------------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.language_models.learning_to_write.language_model_helpers .. automodule:: textattack.constraints.grammaticality.language_models.learning_to_write.language_model_helpers
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.grammaticality.language\_models.learning\_to\_write.learning\_to\_write module
-----------------------------------------------------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.language_models.learning_to_write.learning_to_write .. automodule:: textattack.constraints.grammaticality.language_models.learning_to_write.learning_to_write
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.grammaticality.language\_models.learning\_to\_write.rnn\_model module
--------------------------------------------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.language_models.learning_to_write.rnn_model .. automodule:: textattack.constraints.grammaticality.language_models.learning_to_write.rnn_model
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.constraints.grammaticality.language_models.learning_to_write
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,11 +1,16 @@
textattack.constraints.grammaticality.language\_models package textattack.constraints.grammaticality.language\_models package
============================================================== ==============================================================
.. automodule:: textattack.constraints.grammaticality.language_models
:members:
:undoc-members:
:show-inheritance:
Subpackages Subpackages
----------- -----------
.. toctree:: .. toctree::
:maxdepth: 4 :maxdepth: 6
textattack.constraints.grammaticality.language_models.google_language_model textattack.constraints.grammaticality.language_models.google_language_model
textattack.constraints.grammaticality.language_models.learning_to_write textattack.constraints.grammaticality.language_models.learning_to_write
@@ -13,26 +18,14 @@ Subpackages
Submodules Submodules
---------- ----------
textattack.constraints.grammaticality.language\_models.gpt2 module
------------------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.language_models.gpt2 .. automodule:: textattack.constraints.grammaticality.language_models.gpt2
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.grammaticality.language\_models.language\_model\_constraint module
-----------------------------------------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.language_models.language_model_constraint .. automodule:: textattack.constraints.grammaticality.language_models.language_model_constraint
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.constraints.grammaticality.language_models
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,45 +1,36 @@
textattack.constraints.grammaticality package textattack.constraints.grammaticality package
============================================= =============================================
.. automodule:: textattack.constraints.grammaticality
:members:
:undoc-members:
:show-inheritance:
Subpackages Subpackages
----------- -----------
.. toctree:: .. toctree::
:maxdepth: 4 :maxdepth: 6
textattack.constraints.grammaticality.language_models textattack.constraints.grammaticality.language_models
Submodules Submodules
---------- ----------
textattack.constraints.grammaticality.cola module
-------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.cola .. automodule:: textattack.constraints.grammaticality.cola
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.grammaticality.language\_tool module
-----------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.language_tool .. automodule:: textattack.constraints.grammaticality.language_tool
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.grammaticality.part\_of\_speech module
-------------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.part_of_speech .. automodule:: textattack.constraints.grammaticality.part_of_speech
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.constraints.grammaticality
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,53 +1,40 @@
textattack.constraints.overlap package textattack.constraints.overlap package
====================================== ======================================
.. automodule:: textattack.constraints.overlap
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.constraints.overlap.bleu\_score module
-------------------------------------------------
.. automodule:: textattack.constraints.overlap.bleu_score .. automodule:: textattack.constraints.overlap.bleu_score
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.overlap.chrf\_score module
-------------------------------------------------
.. automodule:: textattack.constraints.overlap.chrf_score .. automodule:: textattack.constraints.overlap.chrf_score
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.overlap.levenshtein\_edit\_distance module
-----------------------------------------------------------------
.. automodule:: textattack.constraints.overlap.levenshtein_edit_distance .. automodule:: textattack.constraints.overlap.levenshtein_edit_distance
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.overlap.max\_words\_perturbed module
-----------------------------------------------------------
.. automodule:: textattack.constraints.overlap.max_words_perturbed .. automodule:: textattack.constraints.overlap.max_words_perturbed
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.overlap.meteor\_score module
---------------------------------------------------
.. automodule:: textattack.constraints.overlap.meteor_score .. automodule:: textattack.constraints.overlap.meteor_score
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.constraints.overlap
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,53 +1,40 @@
textattack.constraints.pre\_transformation package textattack.constraints.pre\_transformation package
================================================== ==================================================
.. automodule:: textattack.constraints.pre_transformation
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.constraints.pre\_transformation.input\_column\_modification module
-----------------------------------------------------------------------------
.. automodule:: textattack.constraints.pre_transformation.input_column_modification .. automodule:: textattack.constraints.pre_transformation.input_column_modification
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.pre\_transformation.max\_word\_index\_modification module
--------------------------------------------------------------------------------
.. automodule:: textattack.constraints.pre_transformation.max_word_index_modification .. automodule:: textattack.constraints.pre_transformation.max_word_index_modification
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.pre\_transformation.min\_word\_length module
-------------------------------------------------------------------
.. automodule:: textattack.constraints.pre_transformation.min_word_length .. automodule:: textattack.constraints.pre_transformation.min_word_length
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.pre\_transformation.repeat\_modification module
----------------------------------------------------------------------
.. automodule:: textattack.constraints.pre_transformation.repeat_modification .. automodule:: textattack.constraints.pre_transformation.repeat_modification
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.pre\_transformation.stopword\_modification module
------------------------------------------------------------------------
.. automodule:: textattack.constraints.pre_transformation.stopword_modification .. automodule:: textattack.constraints.pre_transformation.stopword_modification
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.constraints.pre_transformation
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,11 +1,16 @@
textattack.constraints package textattack.constraints package
============================== ==============================
.. automodule:: textattack.constraints
:members:
:undoc-members:
:show-inheritance:
Subpackages Subpackages
----------- -----------
.. toctree:: .. toctree::
:maxdepth: 4 :maxdepth: 6
textattack.constraints.grammaticality textattack.constraints.grammaticality
textattack.constraints.overlap textattack.constraints.overlap
@@ -15,26 +20,14 @@ Subpackages
Submodules Submodules
---------- ----------
textattack.constraints.constraint module
----------------------------------------
.. automodule:: textattack.constraints.constraint .. automodule:: textattack.constraints.constraint
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.pre\_transformation\_constraint module
-------------------------------------------------------------
.. automodule:: textattack.constraints.pre_transformation_constraint .. automodule:: textattack.constraints.pre_transformation_constraint
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.constraints
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,37 +1,30 @@
textattack.constraints.semantics package textattack.constraints.semantics package
======================================== ========================================
.. automodule:: textattack.constraints.semantics
:members:
:undoc-members:
:show-inheritance:
Subpackages Subpackages
----------- -----------
.. toctree:: .. toctree::
:maxdepth: 4 :maxdepth: 6
textattack.constraints.semantics.sentence_encoders textattack.constraints.semantics.sentence_encoders
Submodules Submodules
---------- ----------
textattack.constraints.semantics.bert\_score module
---------------------------------------------------
.. automodule:: textattack.constraints.semantics.bert_score .. automodule:: textattack.constraints.semantics.bert_score
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.semantics.word\_embedding\_distance module
-----------------------------------------------------------------
.. automodule:: textattack.constraints.semantics.word_embedding_distance .. automodule:: textattack.constraints.semantics.word_embedding_distance
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.constraints.semantics
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,21 +1,16 @@
textattack.constraints.semantics.sentence\_encoders.bert package textattack.constraints.semantics.sentence\_encoders.bert package
================================================================ ================================================================
Submodules
----------
textattack.constraints.semantics.sentence\_encoders.bert.bert module
--------------------------------------------------------------------
.. automodule:: textattack.constraints.semantics.sentence_encoders.bert.bert
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: textattack.constraints.semantics.sentence_encoders.bert .. automodule:: textattack.constraints.semantics.sentence_encoders.bert
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Submodules
----------
.. automodule:: textattack.constraints.semantics.sentence_encoders.bert.bert
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,29 +1,22 @@
textattack.constraints.semantics.sentence\_encoders.infer\_sent package textattack.constraints.semantics.sentence\_encoders.infer\_sent package
======================================================================= =======================================================================
.. automodule:: textattack.constraints.semantics.sentence_encoders.infer_sent
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.constraints.semantics.sentence\_encoders.infer\_sent.infer\_sent module
----------------------------------------------------------------------------------
.. automodule:: textattack.constraints.semantics.sentence_encoders.infer_sent.infer_sent .. automodule:: textattack.constraints.semantics.sentence_encoders.infer_sent.infer_sent
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.semantics.sentence\_encoders.infer\_sent.infer\_sent\_model module
-----------------------------------------------------------------------------------------
.. automodule:: textattack.constraints.semantics.sentence_encoders.infer_sent.infer_sent_model .. automodule:: textattack.constraints.semantics.sentence_encoders.infer_sent.infer_sent_model
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.constraints.semantics.sentence_encoders.infer_sent
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,11 +1,16 @@
textattack.constraints.semantics.sentence\_encoders package textattack.constraints.semantics.sentence\_encoders package
=========================================================== ===========================================================
.. automodule:: textattack.constraints.semantics.sentence_encoders
:members:
:undoc-members:
:show-inheritance:
Subpackages Subpackages
----------- -----------
.. toctree:: .. toctree::
:maxdepth: 4 :maxdepth: 6
textattack.constraints.semantics.sentence_encoders.bert textattack.constraints.semantics.sentence_encoders.bert
textattack.constraints.semantics.sentence_encoders.infer_sent textattack.constraints.semantics.sentence_encoders.infer_sent
@@ -14,26 +19,14 @@ Subpackages
Submodules Submodules
---------- ----------
textattack.constraints.semantics.sentence\_encoders.sentence\_encoder module
----------------------------------------------------------------------------
.. automodule:: textattack.constraints.semantics.sentence_encoders.sentence_encoder .. automodule:: textattack.constraints.semantics.sentence_encoders.sentence_encoder
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.semantics.sentence\_encoders.thought\_vector module
--------------------------------------------------------------------------
.. automodule:: textattack.constraints.semantics.sentence_encoders.thought_vector .. automodule:: textattack.constraints.semantics.sentence_encoders.thought_vector
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.constraints.semantics.sentence_encoders
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,29 +1,22 @@
textattack.constraints.semantics.sentence\_encoders.universal\_sentence\_encoder package textattack.constraints.semantics.sentence\_encoders.universal\_sentence\_encoder package
======================================================================================== ========================================================================================
.. automodule:: textattack.constraints.semantics.sentence_encoders.universal_sentence_encoder
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.constraints.semantics.sentence\_encoders.universal\_sentence\_encoder.multilingual\_universal\_sentence\_encoder module
----------------------------------------------------------------------------------------------------------------------------------
.. automodule:: textattack.constraints.semantics.sentence_encoders.universal_sentence_encoder.multilingual_universal_sentence_encoder .. automodule:: textattack.constraints.semantics.sentence_encoders.universal_sentence_encoder.multilingual_universal_sentence_encoder
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.constraints.semantics.sentence\_encoders.universal\_sentence\_encoder.universal\_sentence\_encoder module
--------------------------------------------------------------------------------------------------------------------
.. automodule:: textattack.constraints.semantics.sentence_encoders.universal_sentence_encoder.universal_sentence_encoder .. automodule:: textattack.constraints.semantics.sentence_encoders.universal_sentence_encoder.universal_sentence_encoder
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.constraints.semantics.sentence_encoders.universal_sentence_encoder
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,37 +1,30 @@
textattack.datasets package textattack.datasets package
=========================== ===========================
.. automodule:: textattack.datasets
:members:
:undoc-members:
:show-inheritance:
Subpackages Subpackages
----------- -----------
.. toctree:: .. toctree::
:maxdepth: 4 :maxdepth: 6
textattack.datasets.translation textattack.datasets.translation
Submodules Submodules
---------- ----------
textattack.datasets.dataset module
----------------------------------
.. automodule:: textattack.datasets.dataset .. automodule:: textattack.datasets.dataset
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.datasets.huggingface\_dataset module
-----------------------------------------------
.. automodule:: textattack.datasets.huggingface_dataset .. automodule:: textattack.datasets.huggingface_dataset
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.datasets
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,21 +1,16 @@
textattack.datasets.translation package textattack.datasets.translation package
======================================= =======================================
Submodules
----------
textattack.datasets.translation.ted\_multi module
-------------------------------------------------
.. automodule:: textattack.datasets.translation.ted_multi
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: textattack.datasets.translation .. automodule:: textattack.datasets.translation
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Submodules
----------
.. automodule:: textattack.datasets.translation.ted_multi
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,37 +1,28 @@
textattack.goal\_function\_results package textattack.goal\_function\_results package
========================================== ==========================================
.. automodule:: textattack.goal_function_results
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.goal\_function\_results.classification\_goal\_function\_result module
--------------------------------------------------------------------------------
.. automodule:: textattack.goal_function_results.classification_goal_function_result .. automodule:: textattack.goal_function_results.classification_goal_function_result
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.goal\_function\_results.goal\_function\_result module
----------------------------------------------------------------
.. automodule:: textattack.goal_function_results.goal_function_result .. automodule:: textattack.goal_function_results.goal_function_result
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.goal\_function\_results.text\_to\_text\_goal\_function\_result module
--------------------------------------------------------------------------------
.. automodule:: textattack.goal_function_results.text_to_text_goal_function_result .. automodule:: textattack.goal_function_results.text_to_text_goal_function_result
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.goal_function_results
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,45 +1,34 @@
textattack.goal\_functions.classification package textattack.goal\_functions.classification package
================================================= =================================================
.. automodule:: textattack.goal_functions.classification
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.goal\_functions.classification.classification\_goal\_function module
-------------------------------------------------------------------------------
.. automodule:: textattack.goal_functions.classification.classification_goal_function .. automodule:: textattack.goal_functions.classification.classification_goal_function
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.goal\_functions.classification.input\_reduction module
-----------------------------------------------------------------
.. automodule:: textattack.goal_functions.classification.input_reduction .. automodule:: textattack.goal_functions.classification.input_reduction
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.goal\_functions.classification.targeted\_classification module
-------------------------------------------------------------------------
.. automodule:: textattack.goal_functions.classification.targeted_classification .. automodule:: textattack.goal_functions.classification.targeted_classification
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.goal\_functions.classification.untargeted\_classification module
---------------------------------------------------------------------------
.. automodule:: textattack.goal_functions.classification.untargeted_classification .. automodule:: textattack.goal_functions.classification.untargeted_classification
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.goal_functions.classification
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,11 +1,16 @@
textattack.goal\_functions package textattack.goal\_functions package
================================== ==================================
.. automodule:: textattack.goal_functions
:members:
:undoc-members:
:show-inheritance:
Subpackages Subpackages
----------- -----------
.. toctree:: .. toctree::
:maxdepth: 4 :maxdepth: 6
textattack.goal_functions.classification textattack.goal_functions.classification
textattack.goal_functions.text textattack.goal_functions.text
@@ -13,18 +18,8 @@ Subpackages
Submodules Submodules
---------- ----------
textattack.goal\_functions.goal\_function module
------------------------------------------------
.. automodule:: textattack.goal_functions.goal_function .. automodule:: textattack.goal_functions.goal_function
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.goal_functions
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,37 +1,28 @@
textattack.goal\_functions.text package textattack.goal\_functions.text package
======================================= =======================================
.. automodule:: textattack.goal_functions.text
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.goal\_functions.text.minimize\_bleu module
-----------------------------------------------------
.. automodule:: textattack.goal_functions.text.minimize_bleu .. automodule:: textattack.goal_functions.text.minimize_bleu
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.goal\_functions.text.non\_overlapping\_output module
---------------------------------------------------------------
.. automodule:: textattack.goal_functions.text.non_overlapping_output .. automodule:: textattack.goal_functions.text.non_overlapping_output
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.goal\_functions.text.text\_to\_text\_goal\_function module
---------------------------------------------------------------------
.. automodule:: textattack.goal_functions.text.text_to_text_goal_function .. automodule:: textattack.goal_functions.text.text_to_text_goal_function
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.goal_functions.text
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,61 +1,46 @@
textattack.loggers package textattack.loggers package
========================== ==========================
.. automodule:: textattack.loggers
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.loggers.attack\_log\_manager module
----------------------------------------------
.. automodule:: textattack.loggers.attack_log_manager .. automodule:: textattack.loggers.attack_log_manager
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.loggers.csv\_logger module
-------------------------------------
.. automodule:: textattack.loggers.csv_logger .. automodule:: textattack.loggers.csv_logger
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.loggers.file\_logger module
--------------------------------------
.. automodule:: textattack.loggers.file_logger .. automodule:: textattack.loggers.file_logger
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.loggers.logger module
--------------------------------
.. automodule:: textattack.loggers.logger .. automodule:: textattack.loggers.logger
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.loggers.visdom\_logger module
----------------------------------------
.. automodule:: textattack.loggers.visdom_logger .. automodule:: textattack.loggers.visdom_logger
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.loggers.weights\_and\_biases\_logger module
------------------------------------------------------
.. automodule:: textattack.loggers.weights_and_biases_logger .. automodule:: textattack.loggers.weights_and_biases_logger
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.loggers
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,61 +1,46 @@
textattack.models.helpers package textattack.models.helpers package
================================= =================================
.. automodule:: textattack.models.helpers
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.models.helpers.bert\_for\_classification module
----------------------------------------------------------
.. automodule:: textattack.models.helpers.bert_for_classification .. automodule:: textattack.models.helpers.bert_for_classification
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.models.helpers.glove\_embedding\_layer module
--------------------------------------------------------
.. automodule:: textattack.models.helpers.glove_embedding_layer .. automodule:: textattack.models.helpers.glove_embedding_layer
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.models.helpers.lstm\_for\_classification module
----------------------------------------------------------
.. automodule:: textattack.models.helpers.lstm_for_classification .. automodule:: textattack.models.helpers.lstm_for_classification
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.models.helpers.t5\_for\_text\_to\_text module
--------------------------------------------------------
.. automodule:: textattack.models.helpers.t5_for_text_to_text .. automodule:: textattack.models.helpers.t5_for_text_to_text
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.models.helpers.utils module
--------------------------------------
.. automodule:: textattack.models.helpers.utils .. automodule:: textattack.models.helpers.utils
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.models.helpers.word\_cnn\_for\_classification module
---------------------------------------------------------------
.. automodule:: textattack.models.helpers.word_cnn_for_classification .. automodule:: textattack.models.helpers.word_cnn_for_classification
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.models.helpers
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,20 +1,17 @@
textattack.models package textattack.models package
========================= =========================
Subpackages
-----------
.. toctree::
:maxdepth: 4
textattack.models.helpers
textattack.models.tokenizers
textattack.models.wrappers
Module contents
---------------
.. automodule:: textattack.models .. automodule:: textattack.models
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Subpackages
-----------
.. toctree::
:maxdepth: 6
textattack.models.helpers
textattack.models.tokenizers
textattack.models.wrappers

View File

@@ -1,37 +1,28 @@
textattack.models.tokenizers package textattack.models.tokenizers package
==================================== ====================================
.. automodule:: textattack.models.tokenizers
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.models.tokenizers.auto\_tokenizer module
---------------------------------------------------
.. automodule:: textattack.models.tokenizers.auto_tokenizer .. automodule:: textattack.models.tokenizers.auto_tokenizer
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.models.tokenizers.glove\_tokenizer module
----------------------------------------------------
.. automodule:: textattack.models.tokenizers.glove_tokenizer .. automodule:: textattack.models.tokenizers.glove_tokenizer
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.models.tokenizers.t5\_tokenizer module
-------------------------------------------------
.. automodule:: textattack.models.tokenizers.t5_tokenizer .. automodule:: textattack.models.tokenizers.t5_tokenizer
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.models.tokenizers
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,53 +1,40 @@
textattack.models.wrappers package textattack.models.wrappers package
================================== ==================================
.. automodule:: textattack.models.wrappers
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.models.wrappers.huggingface\_model\_wrapper module
-------------------------------------------------------------
.. automodule:: textattack.models.wrappers.huggingface_model_wrapper .. automodule:: textattack.models.wrappers.huggingface_model_wrapper
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.models.wrappers.model\_wrapper module
------------------------------------------------
.. automodule:: textattack.models.wrappers.model_wrapper .. automodule:: textattack.models.wrappers.model_wrapper
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.models.wrappers.pytorch\_model\_wrapper module
---------------------------------------------------------
.. automodule:: textattack.models.wrappers.pytorch_model_wrapper .. automodule:: textattack.models.wrappers.pytorch_model_wrapper
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.models.wrappers.sklearn\_model\_wrapper module
---------------------------------------------------------
.. automodule:: textattack.models.wrappers.sklearn_model_wrapper .. automodule:: textattack.models.wrappers.sklearn_model_wrapper
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.models.wrappers.tensorflow\_model\_wrapper module
------------------------------------------------------------
.. automodule:: textattack.models.wrappers.tensorflow_model_wrapper .. automodule:: textattack.models.wrappers.tensorflow_model_wrapper
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.models.wrappers
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,11 +1,14 @@
textattack package Complete API Reference
================== =======================
.. automodule:: textattack
:members:
:undoc-members:
:show-inheritance:
Subpackages
-----------
.. toctree:: .. toctree::
:maxdepth: 4 :maxdepth: 6
textattack.attack_recipes textattack.attack_recipes
textattack.attack_results textattack.attack_results
@@ -20,11 +23,3 @@ Subpackages
textattack.search_methods textattack.search_methods
textattack.shared textattack.shared
textattack.transformations textattack.transformations
Module contents
---------------
.. automodule:: textattack
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,85 +1,64 @@
textattack.search\_methods package textattack.search\_methods package
================================== ==================================
.. automodule:: textattack.search_methods
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.search\_methods.alzantot\_genetic\_algorithm module
--------------------------------------------------------------
.. automodule:: textattack.search_methods.alzantot_genetic_algorithm .. automodule:: textattack.search_methods.alzantot_genetic_algorithm
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.search\_methods.beam\_search module
----------------------------------------------
.. automodule:: textattack.search_methods.beam_search .. automodule:: textattack.search_methods.beam_search
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.search\_methods.genetic\_algorithm module
----------------------------------------------------
.. automodule:: textattack.search_methods.genetic_algorithm .. automodule:: textattack.search_methods.genetic_algorithm
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.search\_methods.greedy\_search module
------------------------------------------------
.. automodule:: textattack.search_methods.greedy_search .. automodule:: textattack.search_methods.greedy_search
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.search\_methods.greedy\_word\_swap\_wir module
---------------------------------------------------------
.. automodule:: textattack.search_methods.greedy_word_swap_wir .. automodule:: textattack.search_methods.greedy_word_swap_wir
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.search\_methods.improved\_genetic\_algorithm module
--------------------------------------------------------------
.. automodule:: textattack.search_methods.improved_genetic_algorithm .. automodule:: textattack.search_methods.improved_genetic_algorithm
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.search\_methods.particle\_swarm\_optimization module
---------------------------------------------------------------
.. automodule:: textattack.search_methods.particle_swarm_optimization .. automodule:: textattack.search_methods.particle_swarm_optimization
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.search\_methods.population\_based\_search module
-----------------------------------------------------------
.. automodule:: textattack.search_methods.population_based_search .. automodule:: textattack.search_methods.population_based_search
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.search\_methods.search\_method module
------------------------------------------------
.. automodule:: textattack.search_methods.search_method .. automodule:: textattack.search_methods.search_method
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.search_methods
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,69 +1,54 @@
textattack.shared package textattack.shared package
========================= =========================
.. automodule:: textattack.shared
:members:
:undoc-members:
:show-inheritance:
Subpackages Subpackages
----------- -----------
.. toctree:: .. toctree::
:maxdepth: 4 :maxdepth: 6
textattack.shared.utils textattack.shared.utils
Submodules Submodules
---------- ----------
textattack.shared.attack module
-------------------------------
.. automodule:: textattack.shared.attack .. automodule:: textattack.shared.attack
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.shared.attacked\_text module
---------------------------------------
.. automodule:: textattack.shared.attacked_text .. automodule:: textattack.shared.attacked_text
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.shared.checkpoint module
-----------------------------------
.. automodule:: textattack.shared.checkpoint .. automodule:: textattack.shared.checkpoint
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.shared.data module
-----------------------------
.. automodule:: textattack.shared.data .. automodule:: textattack.shared.data
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.shared.validators module
-----------------------------------
.. automodule:: textattack.shared.validators .. automodule:: textattack.shared.validators
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.shared.word\_embedding module
----------------------------------------
.. automodule:: textattack.shared.word_embedding .. automodule:: textattack.shared.word_embedding
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.shared
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,45 +1,34 @@
textattack.shared.utils package textattack.shared.utils package
=============================== ===============================
.. automodule:: textattack.shared.utils
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.shared.utils.install module
--------------------------------------
.. automodule:: textattack.shared.utils.install .. automodule:: textattack.shared.utils.install
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.shared.utils.misc module
-----------------------------------
.. automodule:: textattack.shared.utils.misc .. automodule:: textattack.shared.utils.misc
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.shared.utils.strings module
--------------------------------------
.. automodule:: textattack.shared.utils.strings .. automodule:: textattack.shared.utils.strings
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.shared.utils.tensor module
-------------------------------------
.. automodule:: textattack.shared.utils.tensor .. automodule:: textattack.shared.utils.tensor
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.shared.utils
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,197 +1,148 @@
textattack.transformations package textattack.transformations package
================================== ==================================
.. automodule:: textattack.transformations
:members:
:undoc-members:
:show-inheritance:
Submodules Submodules
---------- ----------
textattack.transformations.composite\_transformation module
-----------------------------------------------------------
.. automodule:: textattack.transformations.composite_transformation .. automodule:: textattack.transformations.composite_transformation
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.random\_synonym\_insertion module
------------------------------------------------------------
.. automodule:: textattack.transformations.random_synonym_insertion .. automodule:: textattack.transformations.random_synonym_insertion
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.transformation module
------------------------------------------------
.. automodule:: textattack.transformations.transformation .. automodule:: textattack.transformations.transformation
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_deletion module
------------------------------------------------
.. automodule:: textattack.transformations.word_deletion .. automodule:: textattack.transformations.word_deletion
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap module
--------------------------------------------
.. automodule:: textattack.transformations.word_swap .. automodule:: textattack.transformations.word_swap
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_change\_location module
--------------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_change_location .. automodule:: textattack.transformations.word_swap_change_location
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_change\_name module
----------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_change_name .. automodule:: textattack.transformations.word_swap_change_name
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_change\_number module
------------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_change_number .. automodule:: textattack.transformations.word_swap_change_number
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_contract module
------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_contract .. automodule:: textattack.transformations.word_swap_contract
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_embedding module
-------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_embedding .. automodule:: textattack.transformations.word_swap_embedding
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_extend module
----------------------------------------------------
.. automodule:: textattack.transformations.word_swap_extend .. automodule:: textattack.transformations.word_swap_extend
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_gradient\_based module
-------------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_gradient_based .. automodule:: textattack.transformations.word_swap_gradient_based
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_homoglyph\_swap module
-------------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_homoglyph_swap .. automodule:: textattack.transformations.word_swap_homoglyph_swap
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_hownet module
----------------------------------------------------
.. automodule:: textattack.transformations.word_swap_hownet .. automodule:: textattack.transformations.word_swap_hownet
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_inflections module
---------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_inflections .. automodule:: textattack.transformations.word_swap_inflections
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_masked\_lm module
--------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_masked_lm .. automodule:: textattack.transformations.word_swap_masked_lm
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_neighboring\_character\_swap module
--------------------------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_neighboring_character_swap .. automodule:: textattack.transformations.word_swap_neighboring_character_swap
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_qwerty module
----------------------------------------------------
.. automodule:: textattack.transformations.word_swap_qwerty .. automodule:: textattack.transformations.word_swap_qwerty
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_random\_character\_deletion module
-------------------------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_random_character_deletion .. automodule:: textattack.transformations.word_swap_random_character_deletion
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_random\_character\_insertion module
--------------------------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_random_character_insertion .. automodule:: textattack.transformations.word_swap_random_character_insertion
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_random\_character\_substitution module
-----------------------------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_random_character_substitution .. automodule:: textattack.transformations.word_swap_random_character_substitution
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_random\_word module
----------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_random_word .. automodule:: textattack.transformations.word_swap_random_word
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
textattack.transformations.word\_swap\_wordnet module
-----------------------------------------------------
.. automodule:: textattack.transformations.word_swap_wordnet .. automodule:: textattack.transformations.word_swap_wordnet
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: textattack.transformations
:members:
:undoc-members:
:show-inheritance:

View File

@@ -26,6 +26,7 @@ release = "0.2.11"
# Set master doc to `index.rst`. # Set master doc to `index.rst`.
master_doc = "index" master_doc = "index"
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be # Add any Sphinx extension module names here, as strings. They can be
@@ -41,8 +42,16 @@ extensions = [
"nbsphinx", "nbsphinx",
# Enable .md doc files # Enable .md doc files
"recommonmark", "recommonmark",
# Enable auto toc
'autodocsumm',
] ]
autodoc_default_options = {
'autosummary': True,
}
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = [] templates_path = []
@@ -81,7 +90,7 @@ html_css_files = [
html_favicon = "favicon.png" html_favicon = "favicon.png"
# Don't show module names in front of class names. # Don't show module names in front of class names.
add_module_names = False add_module_names = True
# Sort members by group # Sort members by group
autodoc_member_order = "groupwise" autodoc_member_order = "groupwise"

View File

@@ -1,7 +1,7 @@
.. include:: 1start/basic-Intro.rst .. include:: 1start/basic-Intro.rst
.. toctree:: .. toctree::
:maxdepth: 3 :maxdepth: 6
:caption: About :caption: About
:hidden: :hidden:
@@ -10,7 +10,7 @@
1start/references.md 1start/references.md
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 6
:caption: Get Started :caption: Get Started
Installation <1start/installation> Installation <1start/installation>
@@ -18,7 +18,7 @@
.. toctree:: .. toctree::
:maxdepth: 3 :maxdepth: 6
:caption: Notebook Tutorials :caption: Notebook Tutorials
Tutorial 0: TextAttack End-To-End (Train, Eval, Attack) <2notebook/0_End_to_End.ipynb> Tutorial 0: TextAttack End-To-End (Train, Eval, Attack) <2notebook/0_End_to_End.ipynb>
@@ -31,12 +31,12 @@
.. toctree:: .. toctree::
:maxdepth: 5 :maxdepth: 6
:glob: :glob:
:caption: Developer Guide :caption: Developer Guide
1start/support.md 1start/support.md
1start/api-design-tips.md 1start/api-design-tips.md
api/index 3important/index
source/textattack apidoc/textattack

View File

@@ -1,3 +1,15 @@
"""
Welcome to the API references for TextAttack!
What is TextAttack?
----------------------
`TextAttack <https://github.com/QData/TextAttack>`__ is a Python framework for adversarial attacks, adversarial training, and data augmentation in NLP.
TextAttack makes experimenting with the robustness of NLP models seamless, fast, and easy. It's also useful for NLP model training, adversarial training, and data augmentation.
TextAttack provides components for common NLP tasks like sentence encoding, grammar-checking, and word replacement that can be used on their own.
"""
from . import ( from . import (
attack_recipes, attack_recipes,
attack_results, attack_results,

View File

@@ -1,3 +1,21 @@
"""
We provide a number of pre-built attack recipes, which correspond to attacks from the literature. To run an attack recipe from the command line, run::
textattack attack --recipe [recipe_name]
To initialize an attack in Python script, use::
<recipe name>.build(model_wrapper)
For example, ``attack = InputReductionFeng2018.build(model)`` creates `attack`, an object of type ``Attack`` with the goal function, transformation, constraints, and search method specified in that paper. This object can then be used just like any other attack; for example, by calling ``attack.attack_dataset``.
TextAttack supports the following attack recipes (each recipe's documentation contains a link to the corresponding paper):
.. contents:: :local:
"""
from .attack_recipe import AttackRecipe from .attack_recipe import AttackRecipe
from .bae_garg_2019 import BAEGarg2019 from .bae_garg_2019 import BAEGarg2019

View File

@@ -1,18 +1,3 @@
"""
We provide a number of pre-built attack recipes, which correspond to attacks from the literature. To run an attack recipe from the command line, run::
textattack attack --recipe [recipe_name]
To initialize an attack in Python script, use::
<recipe name>.build(model_wrapper)
For example, ``attack = InputReductionFeng2018.build(model)`` creates `attack`, an object of type ``Attack`` with the goal function, transformation, constraints, and search method specified in that paper. This object can then be used just like any other attack; for example, by calling ``attack.attack_dataset``.
TextAttack supports the following attack recipes (each recipe's documentation contains a link to the corresponding paper):
.. contents:: :local:
"""
from abc import ABC, abstractmethod from abc import ABC, abstractmethod

View File

@@ -1,3 +1,7 @@
"""
BAE (BAE: BERT-Based Adversarial Examples)
"""
from textattack.constraints.grammaticality import PartOfSpeech from textattack.constraints.grammaticality import PartOfSpeech
from textattack.constraints.pre_transformation import ( from textattack.constraints.pre_transformation import (
RepeatModification, RepeatModification,

View File

@@ -1,3 +1,6 @@
"""
BERT-Attack: (BERT-Attack: Adversarial Attack Against BERT Using BERT)
"""
from textattack.constraints.overlap import MaxWordsPerturbed from textattack.constraints.overlap import MaxWordsPerturbed
from textattack.constraints.pre_transformation import ( from textattack.constraints.pre_transformation import (
RepeatModification, RepeatModification,

View File

@@ -1,3 +1,6 @@
"""
CheckList: (Beyond Accuracy: Behavioral Testing of NLP models with CheckList)
"""
from textattack.constraints.pre_transformation import RepeatModification from textattack.constraints.pre_transformation import RepeatModification
from textattack.goal_functions import UntargetedClassification from textattack.goal_functions import UntargetedClassification
from textattack.search_methods import GreedySearch from textattack.search_methods import GreedySearch

View File

@@ -1,3 +1,9 @@
"""
DeepWordBug (Black-box Generation of Adversarial Text Sequences to Evade Deep Learning Classifiers)
"""
from textattack.constraints.overlap import LevenshteinEditDistance from textattack.constraints.overlap import LevenshteinEditDistance
from textattack.constraints.pre_transformation import ( from textattack.constraints.pre_transformation import (
RepeatModification, RepeatModification,

View File

@@ -1,3 +1,10 @@
"""
Faster Alzantot Genetic Algorithm (Certified Robustness to Adversarial Word Substitutions)
"""
from textattack.constraints.grammaticality.language_models import ( from textattack.constraints.grammaticality.language_models import (
LearningToWriteLanguageModel, LearningToWriteLanguageModel,
) )

View File

@@ -1,3 +1,13 @@
"""
Alzantot Genetic Algorithm (Generating Natural Language Adversarial Examples)
.. warning::
This attack uses a very slow language model. Consider using the ``fast-alzantot``
recipe instead.
"""
from textattack.constraints.grammaticality.language_models import ( from textattack.constraints.grammaticality.language_models import (
Google1BillionWordsLanguageModel, Google1BillionWordsLanguageModel,
) )

View File

@@ -1,3 +1,8 @@
"""
HotFlip (HotFlip: White-Box Adversarial Examples for Text Classification)
"""
from textattack.constraints.grammaticality import PartOfSpeech from textattack.constraints.grammaticality import PartOfSpeech
from textattack.constraints.overlap import MaxWordsPerturbed from textattack.constraints.overlap import MaxWordsPerturbed
from textattack.constraints.pre_transformation import ( from textattack.constraints.pre_transformation import (

View File

@@ -1,3 +1,8 @@
"""
Improved Genetic Algorithm (Natural Language Adversarial Attacks and Defenses in Word Level)
"""
from textattack.constraints.overlap import MaxWordsPerturbed from textattack.constraints.overlap import MaxWordsPerturbed
from textattack.constraints.pre_transformation import StopwordModification from textattack.constraints.pre_transformation import StopwordModification
from textattack.constraints.semantics import WordEmbeddingDistance from textattack.constraints.semantics import WordEmbeddingDistance

View File

@@ -1,3 +1,8 @@
"""
Input Reduction (Pathologies of Neural Models Make Interpretations Difficult)
"""
from textattack.constraints.pre_transformation import ( from textattack.constraints.pre_transformation import (
RepeatModification, RepeatModification,
StopwordModification, StopwordModification,

View File

@@ -1,3 +1,8 @@
"""
Kuleshov (Adversarial Examples for Natural Language Classification Problems)
"""
from textattack.constraints.grammaticality.language_models import GPT2 from textattack.constraints.grammaticality.language_models import GPT2
from textattack.constraints.overlap import MaxWordsPerturbed from textattack.constraints.overlap import MaxWordsPerturbed
from textattack.constraints.pre_transformation import ( from textattack.constraints.pre_transformation import (

View File

@@ -1,3 +1,8 @@
"""
MORPHEUS (Its Morphin Time! Combating Linguistic Discrimination with Inflectional Perturbations)
"""
from textattack.constraints.pre_transformation import ( from textattack.constraints.pre_transformation import (
RepeatModification, RepeatModification,
StopwordModification, StopwordModification,

View File

@@ -1,3 +1,7 @@
"""
Combating Adversarial Misspellings with Robust Word Recognition
"""
from textattack.constraints.overlap import MaxWordsPerturbed from textattack.constraints.overlap import MaxWordsPerturbed
from textattack.constraints.pre_transformation import ( from textattack.constraints.pre_transformation import (
MinWordLength, MinWordLength,
@@ -19,11 +23,9 @@ from .attack_recipe import AttackRecipe
class Pruthi2019(AttackRecipe): class Pruthi2019(AttackRecipe):
"""An implementation of the attack used in "Combating Adversarial """An implementation of the attack used in "Combating Adversarial Misspellings with Robust Word Recognition", Pruthi et al., 2019.
Misspellings with Robust Word Recognition", Pruthi et al., 2019.
This attack focuses on a small number of character-level changes This attack focuses on a small number of character-level changes that simulate common typos. It combines:
that simulate common typos. It combines:
- Swapping neighboring characters - Swapping neighboring characters
- Deleting characters - Deleting characters
- Inserting characters - Inserting characters

View File

@@ -1,3 +1,8 @@
"""
Particle Swarm Optimization (Word-level Textual Adversarial Attacking as Combinatorial Optimization)
"""
from textattack.constraints.pre_transformation import ( from textattack.constraints.pre_transformation import (
InputColumnModification, InputColumnModification,
RepeatModification, RepeatModification,

View File

@@ -1,3 +1,8 @@
"""
PWWS (Generating Natural Language Adversarial Examples through Probability Weighted Word Saliency)
"""
from textattack.constraints.pre_transformation import ( from textattack.constraints.pre_transformation import (
RepeatModification, RepeatModification,
StopwordModification, StopwordModification,

View File

@@ -1,3 +1,8 @@
"""
Seq2Sick (Seq2Sick: Evaluating the Robustness of Sequence-to-Sequence Models with Adversarial Examples)
"""
from textattack.constraints.overlap import LevenshteinEditDistance from textattack.constraints.overlap import LevenshteinEditDistance
from textattack.constraints.pre_transformation import ( from textattack.constraints.pre_transformation import (
RepeatModification, RepeatModification,

View File

@@ -1,3 +1,9 @@
"""
TextBugger (TextBugger: Generating Adversarial Text Against Real-world Applications)
"""
# from textattack.constraints.grammaticality import PartOfSpeech # from textattack.constraints.grammaticality import PartOfSpeech
from textattack.constraints.pre_transformation import ( from textattack.constraints.pre_transformation import (
RepeatModification, RepeatModification,

View File

@@ -1,3 +1,10 @@
"""
TextFooler (Is BERT Really Robust? A Strong Baseline for Natural Language Attack on Text Classification and Entailment)
"""
from textattack.constraints.grammaticality import PartOfSpeech from textattack.constraints.grammaticality import PartOfSpeech
from textattack.constraints.pre_transformation import ( from textattack.constraints.pre_transformation import (
InputColumnModification, InputColumnModification,

View File

@@ -1,3 +1,7 @@
"""
Attack Result: The result of an attack's attempt to find a successful adversarial perturbation.
"""
from .maximized_attack_result import MaximizedAttackResult from .maximized_attack_result import MaximizedAttackResult
from .failed_attack_result import FailedAttackResult from .failed_attack_result import FailedAttackResult
from .skipped_attack_result import SkippedAttackResult from .skipped_attack_result import SkippedAttackResult

View File

@@ -1,7 +1,3 @@
"""
The result of an attack's attempt to find a successful adversarial perturbation.
"""
from abc import ABC from abc import ABC

View File

@@ -1,3 +1,7 @@
"""
Augmenter: Transformations and constraints can be used outside of an attack for simple NLP data augmentation with the ``Augmenter`` class that returns all possible transformations for a given string.
"""
from .augmenter import Augmenter from .augmenter import Augmenter
from .recipes import ( from .recipes import (
WordNetAugmenter, WordNetAugmenter,

View File

@@ -1,7 +1,3 @@
"""
Transformations and constraints can be used outside of an attack for simple NLP data augmentation with the ``Augmenter`` class that returns all possible transformations for a given string.
"""
import random import random
import tqdm import tqdm

View File

@@ -1,5 +1,5 @@
""" """
Transformations and constraints can be used for simple NLP data augmentations. Here is a list of recipes for NLP data augmentations Augmenter Recipes: Transformations and constraints can be used for simple NLP data augmentations. Here is a list of recipes for NLP data augmentations
""" """
import random import random

View File

@@ -1,3 +1,11 @@
"""
TextAttack Command Package
===========================
"""
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from .textattack_command import TextAttackCommand from .textattack_command import TextAttackCommand
from . import textattack_cli from . import textattack_cli

View File

@@ -1,3 +1,11 @@
"""
TextAttack Command Package for Attack
------------------------------------------
"""
from .attack_command import AttackCommand from .attack_command import AttackCommand
from .attack_resume_command import AttackResumeCommand from .attack_resume_command import AttackResumeCommand

View File

@@ -1,3 +1,9 @@
"""
TextAttack Augment Command
"""
from argparse import ArgumentDefaultsHelpFormatter, ArgumentError, ArgumentParser from argparse import ArgumentDefaultsHelpFormatter, ArgumentError, ArgumentParser
import csv import csv
import os import os
@@ -18,7 +24,7 @@ AUGMENTATION_RECIPE_NAMES = {
class AugmentCommand(TextAttackCommand): class AugmentCommand(TextAttackCommand):
"""The TextAttack attack module: """The TextAttack Augment Command module:
A command line parser to run data augmentation from user A command line parser to run data augmentation from user
specifications. specifications.

View File

@@ -1,3 +1,9 @@
"""
TextAttack benchmark recipe Command
"""
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
from textattack.commands import TextAttackCommand from textattack.commands import TextAttackCommand

View File

@@ -1 +1,9 @@
"""
TextAttack Command Package for Evaluation
------------------------------------------
"""
from .eval_model_command import EvalModelCommand from .eval_model_command import EvalModelCommand

View File

@@ -1,3 +1,9 @@
"""
TextAttack list Command
"""
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
import textattack import textattack

View File

@@ -1,3 +1,9 @@
"""
TextAttack peek dataset Command
"""
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
import collections import collections
import re import re

View File

@@ -1,3 +1,9 @@
"""
TextAttack Command Arg Parsing
"""
#!/usr/bin/env python #!/usr/bin/env python
import argparse import argparse

View File

@@ -1,3 +1,9 @@
"""
TextAttack Command Class
"""
from abc import ABC, abstractmethod from abc import ABC, abstractmethod

View File

@@ -1 +1,9 @@
"""
TextAttack Command Package for Training
----------------------------------------
"""
from .train_model_command import TrainModelCommand from .train_model_command import TrainModelCommand

View File

@@ -1,3 +1,23 @@
"""
Constraint Package
===================
Constraints determine whether a given transformation is valid. Since transformations do not perfectly preserve semantics semantics or grammaticality, constraints can increase the likelihood that the resulting transformation preserves these qualities. All constraints are subclasses of the ``Constraint`` abstract class, and must implement at least one of ``__call__`` or ``call_many``.
We split constraints into three main categories.
:ref:`Semantics`: Based on the meaning of the input and perturbation.
:ref:`Grammaticality`: Based on syntactic properties like part-of-speech and grammar.
:ref:`Overlap`: Based on character-based properties, like edit distance.
A fourth type of constraint restricts the search method from exploring certain parts of the search space:
:ref:`pre_transformation`: Based on the input and index of word replacement.
"""
from .pre_transformation_constraint import PreTransformationConstraint from .pre_transformation_constraint import PreTransformationConstraint
from .constraint import Constraint from .constraint import Constraint

View File

@@ -1,17 +1,7 @@
""" """
Constraints determine whether a given transformation is valid. Since transformations do not perfectly preserve semantics semantics or grammaticality, constraints can increase the likelihood that the resulting transformation preserves these qualities. All constraints are subclasses of the ``Constraint`` abstract class, and must implement at least one of ``__call__`` or ``call_many``.
We split constraints into three main categories. TextAttack Constraint
:ref:`Semantics`: Based on the meaning of the input and perturbation.
:ref:`Grammaticality`: Based on syntactic properties like part-of-speech and grammar.
:ref:`Overlap`: Based on character-based properties, like edit distance.
A fourth type of constraint restricts the search method from exploring certain parts of the search space:
:ref:`pre_transformation`: Based on the input and index of word replacement.
""" """
from abc import ABC, abstractmethod from abc import ABC, abstractmethod

View File

@@ -1,3 +1,9 @@
"""
Grammaticality: Grammaticality constraints determine if a transformation is valid based on
syntactic properties of the perturbation.
"""
from . import language_models from . import language_models
from .language_tool import LanguageTool from .language_tool import LanguageTool

View File

@@ -1,3 +1,7 @@
"""
CoLA
######
"""
import lru import lru
import nltk import nltk
from transformers import AutoModelForSequenceClassification, AutoTokenizer from transformers import AutoModelForSequenceClassification, AutoTokenizer

View File

@@ -1,3 +1,8 @@
"""
Google 1-Billion Words Language Model
**************************************
"""
from collections import defaultdict from collections import defaultdict
import numpy as np import numpy as np

View File

@@ -1 +1,6 @@
"""
"Learning To Write" Language Model
************************************
"""
from .learning_to_write import LearningToWriteLanguageModel from .learning_to_write import LearningToWriteLanguageModel

View File

@@ -1,3 +1,7 @@
"""
LanguageTool Grammar Checker
##############################
"""
import language_tool_python import language_tool_python
from textattack.constraints import Constraint from textattack.constraints import Constraint

View File

@@ -1,3 +1,7 @@
"""
Part of Speech
###############
"""
import flair import flair
from flair.data import Sentence from flair.data import Sentence
from flair.models import SequenceTagger from flair.models import SequenceTagger

Some files were not shown because too many files have changed in this diff Show More