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
docs/_build/
docs/source/modules.rst
# Packaging
*.egg-info/

View File

@@ -13,3 +13,4 @@ The ``Attack`` class represents an adversarial attack composed of a goal functio
.. automodule:: textattack.shared.attack
: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``.
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:
@@ -19,7 +19,7 @@ TextAttack supports the following attack recipes (each recipe's documentation co
Attacks on classification models
#################################
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
:members:
:noindex:
Faster Alzantot Genetic Algorithm (Certified Robustness to Adversarial Word Substitutions)
**********************************************************************************************
.. automodule:: textattack.attack_recipes.faster_genetic_algorithm_jia_2019
:members:
:noindex:
BAE (BAE: BERT-Based Adversarial Examples)
*********************************************
.. automodule:: textattack.attack_recipes.bae_garg_2019
:members:
:noindex:
BERT-Attack: (BERT-Attack: Adversarial Attack Against BERT Using BERT)
*************************************************************************
.. automodule:: textattack.attack_recipes.bert_attack_li_2020
:members:
:noindex:
CheckList: (Beyond Accuracy: Behavioral Testing of NLP models with CheckList)
*******************************************************************************
.. automodule:: textattack.attack_recipes.checklist_ribeiro_2020
:members:
:noindex:
DeepWordBug (Black-box Generation of Adversarial Text Sequences to Evade Deep Learning Classifiers)
******************************************************************************************************
.. automodule:: textattack.attack_recipes.deepwordbug_gao_2018
:members:
:noindex:
HotFlip (HotFlip: White-Box Adversarial Examples for Text Classification)
******************************************************************************
.. automodule:: textattack.attack_recipes.hotflip_ebrahimi_2017
:members:
:noindex:
Improved Genetic Algorithm (Natural Language Adversarial Attacks and Defenses in Word Level)
*************************************************************************************************
.. automodule:: textattack.attack_recipes.iga_wang_2019
:members:
:noindex:
Input Reduction (Pathologies of Neural Models Make Interpretations Difficult)
************************************************************************************
.. automodule:: textattack.attack_recipes.input_reduction_feng_2018
:members:
:noindex:
Kuleshov (Adversarial Examples for Natural Language Classification Problems)
******************************************************************************
.. automodule:: textattack.attack_recipes.kuleshov_2017
:members:
:noindex:
Particle Swarm Optimization (Word-level Textual Adversarial Attacking as Combinatorial Optimization)
*****************************************************************************************************
.. automodule:: textattack.attack_recipes.pso_zang_2020
:members:
:noindex:
PWWS (Generating Natural Language Adversarial Examples through Probability Weighted Word Saliency)
***************************************************************************************************
.. 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)
************************************************************************************************************************
.. automodule:: textattack.attack_recipes.textfooler_jin_2019
:members:
:noindex:
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
:members:
:noindex:
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
:members:
:noindex:
Seq2Sick (Seq2Sick: Evaluating the Robustness of Sequence-to-Sequence Models with Adversarial Examples)
*********************************************************************************************************
.. automodule:: textattack.attack_recipes.seq2sick_cheng_2018_blackbox
: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
.. automodule:: textattack.augmentation.recipes
.. automodule:: textattack.augmentation.recipes
:members:
:noindex:

View File

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

View File

@@ -8,23 +8,30 @@ Goal functions determine if an attack has been successful.
.. automodule:: textattack.goal_functions.goal_function
:members:
:noindex:
:private-members:
Classification
################
.. automodule:: textattack.goal_functions.classification.classification_goal_function
:members:
:noindex:
.. automodule:: textattack.goal_functions.classification.targeted_classification
:members:
:noindex:
.. automodule:: textattack.goal_functions.classification.untargeted_classification
:members:
:noindex:
Text to Text
##############
.. automodule:: textattack.goal_functions.text.text_to_text_goal_function
:members:
:noindex:
.. automodule:: textattack.goal_functions.text.non_overlapping_output
: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
: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:
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
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.
.. automodule:: textattack.models.wrappers.model_wrapper
:members:
:noindex:
Models User-specified
--------------------------
We've also provided implementations of model wrappers for common patterns in some popular machine learning frameworks:
.. automodule:: textattack.models.wrappers.pytorch_model_wrapper
:members:
:noindex:
.. automodule:: textattack.models.wrappers.tensorflow_model_wrapper
:members:
:noindex:
.. automodule:: textattack.models.wrappers.sklearn_model_wrapper
:members:
:noindex:
.. automodule:: textattack.models.wrappers.huggingface_model_wrapper
:members:
:noindex:
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.
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.
@@ -8,18 +8,21 @@ Search methods explore the transformation space in an attempt to find a successf
:special-members: __call__
:private-members:
:members:
:noindex:
Greedy Search
####################
.. automodule:: textattack.search_methods.greedy_search
:members:
:noindex:
Beam Search
############
.. automodule:: textattack.search_methods.beam_search
:members:
:noindex:
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
:members:
:noindex:
Genetic Algorithm Word Swap
###########################
.. automodule:: textattack.search_methods.genetic_algorithm
:members:
:noindex:
Particle Swarm Optimization
##############################
.. automodule:: textattack.search_methods.particle_swarm_optimization
: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.
@@ -8,7 +8,7 @@ A transformation is a method which perturbs a text input through the insertion,
:special-members: __call__
:private-members:
:members:
:noindex:
Composite Transformation
--------------------------
@@ -16,6 +16,7 @@ Multiple transformations can be used by providing a list of ``Transformation``\s
.. automodule:: textattack.transformations.composite_transformation
:members:
:noindex:
Word Swap
-----------------
@@ -24,6 +25,7 @@ Word swap transformations act by replacing some words in the input. Subclasses c
.. automodule:: textattack.transformations.word_swap
:private-members:
:members:
:noindex:
Word Swap by Embedding
@@ -31,75 +33,91 @@ Word Swap by Embedding
.. automodule:: textattack.transformations.word_swap_embedding
:members:
:noindex:
Word Swap by WordNet Word Replacement
---------------------------------------
.. automodule:: textattack.transformations.word_swap_wordnet
:members:
:noindex:
Word Swap by Gradient
---------------------------------------
.. automodule:: textattack.transformations.word_swap_gradient_based
:members:
:noindex:
Word Swap by Homoglyph
----------------------
.. automodule:: textattack.transformations.word_swap_homoglyph_swap
:members:
:noindex:
Word Swap by Neighboring Character Swap
---------------------------------------
.. automodule:: textattack.transformations.word_swap_neighboring_character_swap
:members:
:noindex:
Word Swap by Random Character Deletion
---------------------------------------
.. automodule:: textattack.transformations.word_swap_random_character_deletion
:members:
:noindex:
Word Swap by Random Character Insertion
---------------------------------------
.. automodule:: textattack.transformations.word_swap_random_character_insertion
:members:
:noindex:
Word Swap by Random Character Substitution
-------------------------------------------
.. automodule:: textattack.transformations.word_swap_random_character_substitution
:members:
:noindex:
Word Swap by Changing Location
-------------------------------
.. automodule:: textattack.transformations.word_swap_change_location
:members:
:noindex:
Word Swap by Changing Number
-------------------------------
.. automodule:: textattack.transformations.word_swap_change_number
:members:
:noindex:
Word Swap by Changing Name
-------------------------------
.. automodule:: textattack.transformations.word_swap_change_name
:members:
:noindex:
Word Swap by Contraction
-------------------------------
.. automodule:: textattack.transformations.word_swap_contract
:members:
:noindex:
Word Swap by Extension
-------------------------------
.. automodule:: textattack.transformations.word_swap_extend
:members:
:noindex:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,37 +1,28 @@
textattack.commands.train\_model package
========================================
.. automodule:: textattack.commands.train_model
:members:
:undoc-members:
:show-inheritance:
Submodules
----------
textattack.commands.train\_model.run\_training module
-----------------------------------------------------
.. automodule:: textattack.commands.train_model.run_training
:members:
:undoc-members:
:show-inheritance:
textattack.commands.train\_model.train\_args\_helpers module
------------------------------------------------------------
.. automodule:: textattack.commands.train_model.train_args_helpers
:members:
:undoc-members:
:show-inheritance:
textattack.commands.train\_model.train\_model\_command module
-------------------------------------------------------------
.. automodule:: textattack.commands.train_model.train_model_command
:members:
:undoc-members:
: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
======================================================================================
.. automodule:: textattack.constraints.grammaticality.language_models.google_language_model
:members:
:undoc-members:
:show-inheritance:
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
:members:
:undoc-members:
: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
:members:
:undoc-members:
: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
:members:
:undoc-members:
:show-inheritance:
textattack.constraints.grammaticality.language\_models.google\_language\_model.lm\_utils module
-----------------------------------------------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.language_models.google_language_model.lm_utils
:members:
:undoc-members:
: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
==================================================================================
.. automodule:: textattack.constraints.grammaticality.language_models.learning_to_write
:members:
:undoc-members:
:show-inheritance:
Submodules
----------
textattack.constraints.grammaticality.language\_models.learning\_to\_write.adaptive\_softmax module
---------------------------------------------------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.language_models.learning_to_write.adaptive_softmax
:members:
:undoc-members:
: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
:members:
:undoc-members:
: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
:members:
:undoc-members:
:show-inheritance:
textattack.constraints.grammaticality.language\_models.learning\_to\_write.rnn\_model module
--------------------------------------------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.language_models.learning_to_write.rnn_model
:members:
:undoc-members:
: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
==============================================================
.. automodule:: textattack.constraints.grammaticality.language_models
:members:
:undoc-members:
:show-inheritance:
Subpackages
-----------
.. toctree::
:maxdepth: 4
:maxdepth: 6
textattack.constraints.grammaticality.language_models.google_language_model
textattack.constraints.grammaticality.language_models.learning_to_write
@@ -13,26 +18,14 @@ Subpackages
Submodules
----------
textattack.constraints.grammaticality.language\_models.gpt2 module
------------------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.language_models.gpt2
:members:
:undoc-members:
:show-inheritance:
textattack.constraints.grammaticality.language\_models.language\_model\_constraint module
-----------------------------------------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.language_models.language_model_constraint
:members:
:undoc-members:
: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
=============================================
.. automodule:: textattack.constraints.grammaticality
:members:
:undoc-members:
:show-inheritance:
Subpackages
-----------
.. toctree::
:maxdepth: 4
:maxdepth: 6
textattack.constraints.grammaticality.language_models
Submodules
----------
textattack.constraints.grammaticality.cola module
-------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.cola
:members:
:undoc-members:
:show-inheritance:
textattack.constraints.grammaticality.language\_tool module
-----------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.language_tool
:members:
:undoc-members:
:show-inheritance:
textattack.constraints.grammaticality.part\_of\_speech module
-------------------------------------------------------------
.. automodule:: textattack.constraints.grammaticality.part_of_speech
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: textattack.constraints.grammaticality
:members:
:undoc-members:
:show-inheritance:

View File

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

View File

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

View File

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

View File

@@ -1,37 +1,30 @@
textattack.constraints.semantics package
========================================
.. automodule:: textattack.constraints.semantics
:members:
:undoc-members:
:show-inheritance:
Subpackages
-----------
.. toctree::
:maxdepth: 4
:maxdepth: 6
textattack.constraints.semantics.sentence_encoders
Submodules
----------
textattack.constraints.semantics.bert\_score module
---------------------------------------------------
.. automodule:: textattack.constraints.semantics.bert_score
:members:
:undoc-members:
:show-inheritance:
textattack.constraints.semantics.word\_embedding\_distance module
-----------------------------------------------------------------
.. automodule:: textattack.constraints.semantics.word_embedding_distance
:members:
:undoc-members:
: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
================================================================
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
:members:
:undoc-members:
: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
=======================================================================
.. automodule:: textattack.constraints.semantics.sentence_encoders.infer_sent
:members:
:undoc-members:
:show-inheritance:
Submodules
----------
textattack.constraints.semantics.sentence\_encoders.infer\_sent.infer\_sent module
----------------------------------------------------------------------------------
.. automodule:: textattack.constraints.semantics.sentence_encoders.infer_sent.infer_sent
:members:
:undoc-members:
:show-inheritance:
textattack.constraints.semantics.sentence\_encoders.infer\_sent.infer\_sent\_model module
-----------------------------------------------------------------------------------------
.. automodule:: textattack.constraints.semantics.sentence_encoders.infer_sent.infer_sent_model
:members:
:undoc-members:
: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
===========================================================
.. automodule:: textattack.constraints.semantics.sentence_encoders
:members:
:undoc-members:
:show-inheritance:
Subpackages
-----------
.. toctree::
:maxdepth: 4
:maxdepth: 6
textattack.constraints.semantics.sentence_encoders.bert
textattack.constraints.semantics.sentence_encoders.infer_sent
@@ -14,26 +19,14 @@ Subpackages
Submodules
----------
textattack.constraints.semantics.sentence\_encoders.sentence\_encoder module
----------------------------------------------------------------------------
.. automodule:: textattack.constraints.semantics.sentence_encoders.sentence_encoder
:members:
:undoc-members:
:show-inheritance:
textattack.constraints.semantics.sentence\_encoders.thought\_vector module
--------------------------------------------------------------------------
.. automodule:: textattack.constraints.semantics.sentence_encoders.thought_vector
:members:
:undoc-members:
: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
========================================================================================
.. automodule:: textattack.constraints.semantics.sentence_encoders.universal_sentence_encoder
:members:
:undoc-members:
:show-inheritance:
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
:members:
:undoc-members:
: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
:members:
:undoc-members:
: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
===========================
.. automodule:: textattack.datasets
:members:
:undoc-members:
:show-inheritance:
Subpackages
-----------
.. toctree::
:maxdepth: 4
:maxdepth: 6
textattack.datasets.translation
Submodules
----------
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:
Module contents
---------------
.. automodule:: textattack.datasets
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,21 +1,16 @@
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
:members:
:undoc-members:
: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
==========================================
.. automodule:: textattack.goal_function_results
:members:
:undoc-members:
:show-inheritance:
Submodules
----------
textattack.goal\_function\_results.classification\_goal\_function\_result module
--------------------------------------------------------------------------------
.. automodule:: textattack.goal_function_results.classification_goal_function_result
:members:
:undoc-members:
:show-inheritance:
textattack.goal\_function\_results.goal\_function\_result module
----------------------------------------------------------------
.. automodule:: textattack.goal_function_results.goal_function_result
:members:
:undoc-members:
:show-inheritance:
textattack.goal\_function\_results.text\_to\_text\_goal\_function\_result module
--------------------------------------------------------------------------------
.. automodule:: textattack.goal_function_results.text_to_text_goal_function_result
:members:
:undoc-members:
: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
=================================================
.. automodule:: textattack.goal_functions.classification
:members:
:undoc-members:
:show-inheritance:
Submodules
----------
textattack.goal\_functions.classification.classification\_goal\_function module
-------------------------------------------------------------------------------
.. automodule:: textattack.goal_functions.classification.classification_goal_function
:members:
:undoc-members:
:show-inheritance:
textattack.goal\_functions.classification.input\_reduction module
-----------------------------------------------------------------
.. automodule:: textattack.goal_functions.classification.input_reduction
:members:
:undoc-members:
:show-inheritance:
textattack.goal\_functions.classification.targeted\_classification module
-------------------------------------------------------------------------
.. automodule:: textattack.goal_functions.classification.targeted_classification
:members:
:undoc-members:
:show-inheritance:
textattack.goal\_functions.classification.untargeted\_classification module
---------------------------------------------------------------------------
.. automodule:: textattack.goal_functions.classification.untargeted_classification
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: textattack.goal_functions.classification
:members:
:undoc-members:
:show-inheritance:

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,20 +1,17 @@
textattack.models package
=========================
Subpackages
-----------
.. toctree::
:maxdepth: 4
textattack.models.helpers
textattack.models.tokenizers
textattack.models.wrappers
Module contents
---------------
.. automodule:: textattack.models
:members:
:undoc-members:
: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
====================================
.. automodule:: textattack.models.tokenizers
:members:
:undoc-members:
:show-inheritance:
Submodules
----------
textattack.models.tokenizers.auto\_tokenizer module
---------------------------------------------------
.. automodule:: textattack.models.tokenizers.auto_tokenizer
:members:
:undoc-members:
:show-inheritance:
textattack.models.tokenizers.glove\_tokenizer module
----------------------------------------------------
.. automodule:: textattack.models.tokenizers.glove_tokenizer
:members:
:undoc-members:
:show-inheritance:
textattack.models.tokenizers.t5\_tokenizer module
-------------------------------------------------
.. automodule:: textattack.models.tokenizers.t5_tokenizer
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: textattack.models.tokenizers
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,53 +1,40 @@
textattack.models.wrappers package
==================================
.. automodule:: textattack.models.wrappers
:members:
:undoc-members:
:show-inheritance:
Submodules
----------
textattack.models.wrappers.huggingface\_model\_wrapper module
-------------------------------------------------------------
.. automodule:: textattack.models.wrappers.huggingface_model_wrapper
:members:
:undoc-members:
:show-inheritance:
textattack.models.wrappers.model\_wrapper module
------------------------------------------------
.. automodule:: textattack.models.wrappers.model_wrapper
:members:
:undoc-members:
:show-inheritance:
textattack.models.wrappers.pytorch\_model\_wrapper module
---------------------------------------------------------
.. automodule:: textattack.models.wrappers.pytorch_model_wrapper
:members:
:undoc-members:
:show-inheritance:
textattack.models.wrappers.sklearn\_model\_wrapper module
---------------------------------------------------------
.. automodule:: textattack.models.wrappers.sklearn_model_wrapper
:members:
:undoc-members:
:show-inheritance:
textattack.models.wrappers.tensorflow\_model\_wrapper module
------------------------------------------------------------
.. automodule:: textattack.models.wrappers.tensorflow_model_wrapper
:members:
:undoc-members:
: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::
:maxdepth: 4
:maxdepth: 6
textattack.attack_recipes
textattack.attack_results
@@ -20,11 +23,3 @@ Subpackages
textattack.search_methods
textattack.shared
textattack.transformations
Module contents
---------------
.. automodule:: textattack
:members:
:undoc-members:
:show-inheritance:

View File

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

View File

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

View File

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

View File

@@ -1,197 +1,148 @@
textattack.transformations package
==================================
.. automodule:: textattack.transformations
:members:
:undoc-members:
:show-inheritance:
Submodules
----------
textattack.transformations.composite\_transformation module
-----------------------------------------------------------
.. automodule:: textattack.transformations.composite_transformation
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.random\_synonym\_insertion module
------------------------------------------------------------
.. automodule:: textattack.transformations.random_synonym_insertion
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.transformation module
------------------------------------------------
.. automodule:: textattack.transformations.transformation
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_deletion module
------------------------------------------------
.. automodule:: textattack.transformations.word_deletion
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap module
--------------------------------------------
.. automodule:: textattack.transformations.word_swap
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_change\_location module
--------------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_change_location
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_change\_name module
----------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_change_name
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_change\_number module
------------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_change_number
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_contract module
------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_contract
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_embedding module
-------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_embedding
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_extend module
----------------------------------------------------
.. automodule:: textattack.transformations.word_swap_extend
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_gradient\_based module
-------------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_gradient_based
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_homoglyph\_swap module
-------------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_homoglyph_swap
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_hownet module
----------------------------------------------------
.. automodule:: textattack.transformations.word_swap_hownet
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_inflections module
---------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_inflections
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_masked\_lm module
--------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_masked_lm
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_neighboring\_character\_swap module
--------------------------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_neighboring_character_swap
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_qwerty module
----------------------------------------------------
.. automodule:: textattack.transformations.word_swap_qwerty
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_random\_character\_deletion module
-------------------------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_random_character_deletion
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_random\_character\_insertion module
--------------------------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_random_character_insertion
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_random\_character\_substitution module
-----------------------------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_random_character_substitution
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_random\_word module
----------------------------------------------------------
.. automodule:: textattack.transformations.word_swap_random_word
:members:
:undoc-members:
:show-inheritance:
textattack.transformations.word\_swap\_wordnet module
-----------------------------------------------------
.. automodule:: textattack.transformations.word_swap_wordnet
:members:
:undoc-members:
: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`.
master_doc = "index"
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
@@ -41,8 +42,16 @@ extensions = [
"nbsphinx",
# Enable .md doc files
"recommonmark",
# Enable auto toc
'autodocsumm',
]
autodoc_default_options = {
'autosummary': True,
}
# Add any paths that contain templates here, relative to this directory.
templates_path = []
@@ -81,7 +90,7 @@ html_css_files = [
html_favicon = "favicon.png"
# Don't show module names in front of class names.
add_module_names = False
add_module_names = True
# Sort members by group
autodoc_member_order = "groupwise"

View File

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

View File

@@ -1,3 +1,7 @@
"""
BAE (BAE: BERT-Based Adversarial Examples)
"""
from textattack.constraints.grammaticality import PartOfSpeech
from textattack.constraints.pre_transformation import (
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.pre_transformation import (
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.goal_functions import UntargetedClassification
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.pre_transformation import (
RepeatModification,

View File

@@ -1,3 +1,10 @@
"""
Faster Alzantot Genetic Algorithm (Certified Robustness to Adversarial Word Substitutions)
"""
from textattack.constraints.grammaticality.language_models import (
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 (
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.overlap import MaxWordsPerturbed
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.pre_transformation import StopwordModification
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 (
RepeatModification,
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.overlap import MaxWordsPerturbed
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 (
RepeatModification,
StopwordModification,

View File

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

View File

@@ -1,3 +1,8 @@
"""
PWWS (Generating Natural Language Adversarial Examples through Probability Weighted Word Saliency)
"""
from textattack.constraints.pre_transformation import (
RepeatModification,
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.pre_transformation import (
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.pre_transformation import (
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.pre_transformation import (
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 .failed_attack_result import FailedAttackResult
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

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 .recipes import (
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 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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1 +1,9 @@
"""
TextAttack Command Package for Training
----------------------------------------
"""
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 .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

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 .language_tool import LanguageTool

View File

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

View File

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

View File

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

View File

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

View File

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

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