diff --git a/docs/api/transformations.rst b/docs/api/transformations.rst index ab6761bdc..508e46a6d 100644 --- a/docs/api/transformations.rst +++ b/docs/api/transformations.rst @@ -11,3 +11,13 @@ Composite Transformation .. autoclass:: textattack.transformations.CompositeTransformation :members: + + +.. toctree:: + :maxdepth: 6 + + textattack.transformations.sentence_transformations + textattack.transformations.word_insertions + textattack.transformations.word_merges + textattack.transformations.word_swaps + diff --git a/docs/index.rst b/docs/index.rst index 5f1934a4a..28e263d8a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -69,7 +69,7 @@ TextAttack Documentation .. toctree:: - :maxdepth: 6 + :maxdepth: 7 :glob: :caption: Full Reference diff --git a/textattack/attack_recipes/chinese_recipe.py b/textattack/attack_recipes/chinese_recipe.py index f72be2a31..97b568402 100644 --- a/textattack/attack_recipes/chinese_recipe.py +++ b/textattack/attack_recipes/chinese_recipe.py @@ -1,3 +1,11 @@ +""" +Attack Chinese Recipe +===================== + +(Contextualized Perturbation for Chinese NLP Adversarial Attack) + +""" + import string from textattack import Attack diff --git a/textattack/attack_recipes/french_recipe.py b/textattack/attack_recipes/french_recipe.py index 8f0b2b600..7061ad217 100644 --- a/textattack/attack_recipes/french_recipe.py +++ b/textattack/attack_recipes/french_recipe.py @@ -1,3 +1,11 @@ +""" +Attack French Recipe +==================== + +(Contextualized Perturbation for French NLP Adversarial Attack) + +""" + from textattack import Attack from textattack.constraints.pre_transformation import ( RepeatModification, diff --git a/textattack/attack_recipes/spanish_recipe.py b/textattack/attack_recipes/spanish_recipe.py index bca39b307..75519da94 100644 --- a/textattack/attack_recipes/spanish_recipe.py +++ b/textattack/attack_recipes/spanish_recipe.py @@ -1,3 +1,11 @@ +""" +Attack Spanish Recipe +===================== + +(Contextualized Perturbation for Spanish NLP Adversarial Attack) + +""" + from textattack import Attack from textattack.constraints.pre_transformation import ( RepeatModification, diff --git a/textattack/constraints/semantics/sentence_encoders/__init__.py b/textattack/constraints/semantics/sentence_encoders/__init__.py index 6cf05efdd..6c8e88b38 100644 --- a/textattack/constraints/semantics/sentence_encoders/__init__.py +++ b/textattack/constraints/semantics/sentence_encoders/__init__.py @@ -1,6 +1,6 @@ """ -Sentence Encoder ---------------------- +Sentence Encoder Constraint +---------------------------- """ diff --git a/textattack/constraints/semantics/sentence_encoders/bert/bert.py b/textattack/constraints/semantics/sentence_encoders/bert/bert.py index f409fdc44..0972411b0 100644 --- a/textattack/constraints/semantics/sentence_encoders/bert/bert.py +++ b/textattack/constraints/semantics/sentence_encoders/bert/bert.py @@ -1,5 +1,5 @@ """ -BERT for Sentence Similarity +sBERT for Sentence Similarity ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ """ diff --git a/textattack/goal_functions/classification/hardlabel_classification.py b/textattack/goal_functions/classification/hardlabel_classification.py index 60e01e7d2..354225d8c 100644 --- a/textattack/goal_functions/classification/hardlabel_classification.py +++ b/textattack/goal_functions/classification/hardlabel_classification.py @@ -1,6 +1,6 @@ """ Determine if an attack has been successful in Hard Label Classficiation. ----------------------------------------------------- +------------------------------------------------------------------------ """ diff --git a/textattack/goal_functions/classification/input_reduction.py b/textattack/goal_functions/classification/input_reduction.py index f2a6da2df..40769ae77 100644 --- a/textattack/goal_functions/classification/input_reduction.py +++ b/textattack/goal_functions/classification/input_reduction.py @@ -1,6 +1,6 @@ """ -Determine if maintaining the same predicted label +Determine if maintaining the same predicted label (input reduction) --------------------------------------------------------------------- """ diff --git a/textattack/search_methods/population_based_search.py b/textattack/search_methods/population_based_search.py index e3fe951c1..1df80960f 100644 --- a/textattack/search_methods/population_based_search.py +++ b/textattack/search_methods/population_based_search.py @@ -1,6 +1,6 @@ """ -Population based Search -========================== +Population based Search abstract class +======================================= """ from abc import ABC, abstractmethod diff --git a/textattack/transformations/word_swaps/chn_transformations/chinese_homophone_character_swap.py b/textattack/transformations/word_swaps/chn_transformations/chinese_homophone_character_swap.py index 0573f7267..1f2a47a14 100644 --- a/textattack/transformations/word_swaps/chn_transformations/chinese_homophone_character_swap.py +++ b/textattack/transformations/word_swaps/chn_transformations/chinese_homophone_character_swap.py @@ -1,3 +1,9 @@ +""" +Word Swap by chinese homophone +------------------------------------- +""" + + import os import pandas as pd diff --git a/textattack/transformations/word_swaps/chn_transformations/chinese_morphonym_character_swap.py b/textattack/transformations/word_swaps/chn_transformations/chinese_morphonym_character_swap.py index 82692f352..15b98dd19 100644 --- a/textattack/transformations/word_swaps/chn_transformations/chinese_morphonym_character_swap.py +++ b/textattack/transformations/word_swaps/chn_transformations/chinese_morphonym_character_swap.py @@ -1,3 +1,8 @@ +""" +Word Swap by chinese morphonym +------------------------------------- +""" + from textattack.shared.data import MORPHONYM_LS from . import WordSwap diff --git a/textattack/transformations/word_swaps/chn_transformations/chinese_word_swap_hownet.py b/textattack/transformations/word_swaps/chn_transformations/chinese_word_swap_hownet.py index 2743ae4b6..73ba26dbf 100644 --- a/textattack/transformations/word_swaps/chn_transformations/chinese_word_swap_hownet.py +++ b/textattack/transformations/word_swaps/chn_transformations/chinese_word_swap_hownet.py @@ -1,3 +1,8 @@ +""" +Word Swap by chinese hownet +------------------------------------- +""" + import OpenHowNet from . import WordSwap diff --git a/textattack/transformations/word_swaps/chn_transformations/chinese_word_swap_masked.py b/textattack/transformations/word_swaps/chn_transformations/chinese_word_swap_masked.py index 6973e3117..95cb9c3de 100644 --- a/textattack/transformations/word_swaps/chn_transformations/chinese_word_swap_masked.py +++ b/textattack/transformations/word_swaps/chn_transformations/chinese_word_swap_masked.py @@ -1,6 +1,6 @@ """ -Word Swap by BERT-Masked LM. -------------------------------- +Word Swap by chinese BERT-Masked LM. +------------------------------------- """ from transformers import pipeline