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

View File

@@ -1,3 +1,13 @@
"""
Shared Functions
=================
This package includes functions shared across packages.
"""
from . import data
from . import utils
from .utils import logger

View File

@@ -1,4 +1,5 @@
"""TextAttack builds attacks from four components:
"""
Attack: TextAttack builds attacks from four components:
- `Goal Functions <../attacks/goal_function.html>`__ stipulate the goal of the attack, like to change the prediction score of a classification model, or to change all of the words in a translation output.
- `Constraints <../attacks/constraint.html>`__ determine if a potential perturbation is valid with respect to the original input.

View File

@@ -1,3 +1,8 @@
"""
Attacked Text
"""
from collections import OrderedDict
import math

View File

@@ -1,3 +1,9 @@
"""
Misc Checkpoints
The ``Checkpoint`` class saves in-progress attacks and loads saved attacks from disk.
"""
import copy
import datetime
import os

View File

@@ -1,3 +1,9 @@
"""
Shared data
"""
# fmt: off
"""Lists of named entities: countries, nationalities, cities."""
NAMED_ENTITIES = {

View File

@@ -16,6 +16,7 @@ def html_style_from_dict(style_dict):
{ 'color': 'red', 'height': '100px'}
into
style: "color: red; height: 100px"
"""
style_str = ""
for key in style_dict:

View File

@@ -1,3 +1,9 @@
"""
Misc Validators
Validators ensure compatibility between search methods, transformations, constraints, and goal functions.
"""
import re
import textattack

View File

@@ -1,3 +1,8 @@
"""
Shared loads word embeddings and related distances
"""
import os
import pickle