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:
@@ -1,3 +1,13 @@
|
||||
"""
|
||||
Shared Functions
|
||||
=================
|
||||
|
||||
This package includes functions shared across packages.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
|
||||
from . import data
|
||||
from . import utils
|
||||
from .utils import logger
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
"""
|
||||
Attacked Text
|
||||
|
||||
"""
|
||||
|
||||
from collections import OrderedDict
|
||||
import math
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
"""
|
||||
Shared data
|
||||
|
||||
"""
|
||||
|
||||
|
||||
# fmt: off
|
||||
"""Lists of named entities: countries, nationalities, cities."""
|
||||
NAMED_ENTITIES = {
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
"""
|
||||
Misc Validators
|
||||
|
||||
Validators ensure compatibility between search methods, transformations, constraints, and goal functions.
|
||||
|
||||
"""
|
||||
import re
|
||||
|
||||
import textattack
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
"""
|
||||
Shared loads word embeddings and related distances
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
import pickle
|
||||
|
||||
|
||||
Reference in New Issue
Block a user