textattack.goal_function_results.custom package

Custom Goal Function Result package:

Custom goal function results

Submodules

LogitSumGoalFunctionResult Class

logit sum goal function Result

class textattack.goal_function_results.custom.logit_sum_goal_function_result.LogitSumGoalFunctionResult(attacked_text, raw_output, output, goal_status, score, num_queries, ground_truth_output)[source]

Bases: GoalFunctionResult

Represents the result of a text-to-text goal function.

get_colored_output(color_method=None)[source]

Returns a string representation of this result’s output, colored according to color_method.

get_text_color_input()[source]

A string representing the color this result’s changed portion should be if it represents the original input.

get_text_color_perturbed()[source]

A string representing the color this result’s changed portion should be if it represents the perturbed input.

NamedEntityRecognitionoalFunctionResult Class

logit sum goal function Result

class textattack.goal_function_results.custom.named_entity_recognition_goal_function_result.NamedEntityRecognitionGoalFunctionResult(attacked_text, raw_output, output, goal_status, score, num_queries, ground_truth_output)[source]

Bases: GoalFunctionResult

Represents the result of a text-to-text goal function.

get_colored_output(color_method=None)[source]

Returns a string representation of this result’s output, colored according to color_method.

get_text_color_input()[source]

A string representing the color this result’s changed portion should be if it represents the original input.

get_text_color_perturbed()[source]

A string representing the color this result’s changed portion should be if it represents the perturbed input.

TargetedBonusGoalFunctionResult Class

targeted bonus goal function Result

class textattack.goal_function_results.custom.targeted_bonus_goal_function_result.TargetedBonusGoalFunctionResult(attacked_text, raw_output, output, goal_status, score, num_queries, ground_truth_output)[source]

Bases: GoalFunctionResult

Represents the result of a text-to-text goal function.

get_colored_output(color_method=None)[source]

Returns a string representation of this result’s output, colored according to color_method.

get_text_color_input()[source]

A string representing the color this result’s changed portion should be if it represents the original input.

get_text_color_perturbed()[source]

A string representing the color this result’s changed portion should be if it represents the perturbed input.

TargetedStrictGoalFunctionResult Class

targeted strict goal function Result

class textattack.goal_function_results.custom.targeted_strict_goal_function_result.TargetedStrictGoalFunctionResult(attacked_text, raw_output, output, goal_status, score, num_queries, ground_truth_output)[source]

Bases: GoalFunctionResult

Represents the result of a text-to-text goal function.

get_colored_output(color_method=None)[source]

Returns a string representation of this result’s output, colored according to color_method.

get_text_color_input()[source]

A string representing the color this result’s changed portion should be if it represents the original input.

get_text_color_perturbed()[source]

A string representing the color this result’s changed portion should be if it represents the perturbed input.