Labelers

What is a labeler?

A labeler inherits from LabelerInterface, assigning a Labels object to the ArgumentationTheory. Such a StabilityLabel object to each Literal and Rule in the ArgumentationTheory.

class Labels(literal_labeling, rule_labeling)

Bases: object

A Labels object consists of a Literal labeling, assigning StabilityLabels to Literals, and a Rule labeling, assigning StabilityLabels to Rules.

class StabilityLabel(unsatisfiable, defended, out, blocked)

Bases: object

A StabilityLabel consists of four booleans, corresponding to the statuses unsatisfiable, defended, out and blocked.

classmethod from_str(label_str)

Read the label from a string.

Parameters

label_str (str) – String containing the information on the StabilityLabel.

Returns

StabilityLabel read from the string.

property is_contested_stable

Is the StabilityLabel contested-stable? This is the case if either the StabilityLabel is stable-defended or if the defended-boolean is False.

Returns

Boolean indicating if the StabilityLabel is contested-stable.

>>> StabilityLabel(False, True, False, False).is_contested_stable
True
>>> StabilityLabel(True, True, False, False).is_contested_stable
False
>>> StabilityLabel(True, False, True, False).is_contested_stable
True
property is_stable: bool

Is the StabilityLabel stable? This is the case if only one of the booleans is True.

Return type

bool

Returns

Boolean indicating if the StabilityLabel is stable.

>>> StabilityLabel(True, False, False, False).is_stable
True
>>> StabilityLabel(True, True, False, False).is_stable
False

Types of labelers

class LabelerInterface

Bases: object

Interface for labelers. Actual Labeler-objects inherit from this class. They should all have a label method.

label(argumentation_theory)

Assign Labels to each Literal and Rule in the ArgumentationTheory.

Parameters

argumentation_theory (ArgumentationTheory) – ArgumentationTheory that should be labelled.

Return type

Labels

Returns

Labels for the ArgumentationTheory.

class FourBoolLabeler

Bases: modules.argumentation.labelers.labeler_interface.LabelerInterface

The FourBoolLabeler is the labeler presented at COMMA 2020 (version with classical negation) and submitted to ESwA. This Labeler uses the SatisfiabilityLabeler as preprocessing step and subsequently iteratively checks which of the four booleans in the StabilityLabels can be turned from True to False.

static color_literal(argumentation_theory, literal, labels)

Color the Literal, that is: check, based on observations/rules for this literal/rules for its contraries, if this Literal can still become unsatisfiable/defended/out/blocked.

static color_rule(rule, labels)

Color the Rule, that is: check, based on is children, if this Rule can still become unsatisfiable/defended/out/blocked.

label(argumentation_theory)

Assign Labels to each Literal and Rule in the ArgumentationTheory.

Parameters

argumentation_theory (ArgumentationTheory) – ArgumentationTheory that should be labelled.

Return type

Labels

Returns

Labels for the ArgumentationTheory.

class SatisfiabilityLabeler

Bases: modules.argumentation.labelers.labeler_interface.LabelerInterface

Proprocessing step of the FourBoolLabeler. Checks for each Literal if there is a potential argument for this Literal and for each Rule if there is a potential argument based on this Rule.

label(argumentation_theory)

Assign Labels to each Literal and Rule in the ArgumentationTheory.

Parameters

argumentation_theory (ArgumentationTheory) – ArgumentationTheory that should be labelled.

Return type

Labels

Returns

Labels for the ArgumentationTheory.

class JustificationLabeler

Bases: modules.argumentation.labelers.labeler_interface.LabelerInterface

The JustificationLabeler labels literals according to their justification status. For example, if a literal is defended in the current ArgumentationTheory, then it is assigned the StabilityLabel(False, True, False, False). In order to do so, it uses the SatisfiableLabeler in the preprocessing step.

static color_literal(argumentation_theory, literal, labels)

Color the Literal, that is: check, based on observations/Rules for this Literal/Rules for its contraries, if this Literal may be unsatisfiable, defended, out or blocked.

static color_rule(rule, labels)

Color the Rule, that is: check, based on its antecedents, if this Rule can still become unsatisfiable, defended, out or blocked.

label(argumentation_theory)

Assign Labels to each Literal and Rule in the ArgumentationTheory.

Parameters

argumentation_theory (ArgumentationTheory) – ArgumentationTheory that should be labelled.

Return type

Labels

Returns

Labels for the ArgumentationTheory.

class SatisfiableLabeler

Bases: modules.argumentation.labelers.labeler_interface.LabelerInterface

The SatisfiableLabeler is used in the preprocessing step of the AcceptabilityLabeler. It checks for each Literal if there is an argument for the Literal in the current ArgumentationTheory and for each Rule if there is an argument based on this Rule in the current ArgumentationTheory.

label(argumentation_theory)

Assign Labels to each Literal and Rule in the ArgumentationTheory.

Parameters

argumentation_theory (ArgumentationTheory) – ArgumentationTheory that should be labelled.

Return type

Labels

Returns

Labels for the ArgumentationTheory.

class FQASLabeler

Bases: modules.argumentation.labelers.labeler_interface.LabelerInterface

This is an initial labeler for stability, as presented at FQAS 2019. The FQASLabeler only assigns a single label (here modelled as the “stable” StabilityLabels) corresponding to stable justification statuses or some unknown label (here modelled as StableLabel(True, True, True, True)) for Literals and Rules that are not recognised as being stable. Note that this algorithm recognises less stable situations than the FourBoolLabeler.

color_literal(argumentation_theory, literal)

Color the Literal, that is: check, based on observations/rules for this literal/rules for its contraries, if this Literal can still become unsatisfiable/defended/out/blocked.

color_rule(rule)

Color the Rule, that is: check, based on is antecedents, if this Rule can still become unsatisfiable/defended/out/blocked.

label(argumentation_theory)

Assign Labels to each Literal and Rule in the ArgumentationTheory.

Parameters

argumentation_theory (ArgumentationTheory) – ArgumentationTheory that should be labelled.

Return type

Labels

Returns

Labels for the ArgumentationTheory.

class NaiveStabilityLabeler

Bases: modules.argumentation.labelers.labeler_interface.LabelerInterface

An exact but extremely slow labeler for detecting stability. Given some ArgumentationTheory, NaiveStabilityLabeler generates all future ArgumentationTheories and runs the JustificationLabeler’s label algorithm on each of them. Only if the label is the same for all future ArgumentationTheories, the corresponding Literal or Rule is labelled stable. This algorithm is exponential.

label(argumentation_theory)

Assign Labels to each Literal and Rule in the ArgumentationTheory.

Parameters

argumentation_theory (ArgumentationTheory) – ArgumentationTheory that should be labelled.

Return type

Labels

Returns

Labels for the ArgumentationTheory.

class TimedFourBoolLabeler

Bases: modules.argumentation.labelers.four_bool_labeler.FourBoolLabeler

This is a timed version of the regular FourBoolLabeler, which returns not only the Labels but only the number of calls to the methods for relabelling Literals and Rules.

label(argumentation_theory)

Assign Labels to each Literal and Rule in the ArgumentationTheory and record the number of calls to the methods for relabelling Literals and Rules.

Parameters

argumentation_theory (ArgumentationTheory) – ArgumentationTheory that should be labelled.

Return type

Tuple[Labels, int, int]

Returns

Labels for the ArgumentationTheory, number of calls relabelling Literals and Rules.

Example usage

from stability_label_algorithm.modules.argumentation.importers.argumentation_system_xlsx_reader import \
ArgumentationSystemXLSXReader
from stability_label_algorithm.modules.argumentation.argumentation_theory.argumentation_system import \
    ArgumentationSystem
from stability_label_algorithm.modules.argumentation.argumentation_engine import ArgumentationEngine
from stability_label_algorithm.modules.argumentation.labelers.fqas_labeler import FQASLabeler
from stability_label_algorithm.modules.argumentation.labelers.four_bool_labeler import FourBoolLabeler
from stability_label_algorithm.modules.argumentation.labelers.satisfiability_labeler import SatisfiabilityLabeler
from stability_label_algorithm.modules.argumentation.labelers.acceptability_labeler import AcceptabilityLabeler

asr = ArgumentationSystemXLSXReader(path_to_resources('03_2019_FQAS_Paper_Example'))
arg_system = ArgumentationSystem(asr.language, asr.rules, asr.topic_literals)
arg_engine_four_bool = ArgumentationEngine(arg_system, FourBoolLabeler())
arg_engine_fqas = ArgumentationEngine(arg_system, FQASLabeler())
arg_engine_acceptability = ArgumentationEngine(arg_system, AcceptabilityLabeler())
arg_engine_satisfiablility = ArgumentationEngine(arg_system, SatisfiabilityLabeler())

First consider a few usages of modules.argumentation.labelers.fqas_labeler.FQASLabeler:

>>> arg_engine_fqas_output = arg_engine_fqas.update(['wrong_product'])
>>> arg_engine_fqas_output.labels.literal_labeling[arg_system.language['fraud']].is_stable
False
>>> arg_engine_fqas_output.labels.literal_labeling[arg_system.language['fraud']].is_contested_stable
False
>>> arg_engine_fqas_output = arg_engine_fqas.update(['wrong_product', 'counter_party_delivered'])
>>> arg_engine_fqas_output.labels.literal_labeling[arg_system.language['fraud']].is_stable
True
>>> arg_engine_fqas_output = arg_engine_fqas.update(['counter_party_delivered'])
>>> arg_engine_fqas_output.labels.literal_labeling[arg_system.language['fraud']].is_contested_stable
True
>>> arg_engine_four_bool_output = arg_engine_four_bool.update(['wrong_product'])
>>> arg_engine_four_bool_output.labels.literal_labeling[arg_system.language['fraud']].is_stable
False
>>> arg_engine_four_bool_output.labels.literal_labeling[arg_system.language['fraud']].is_contested_stable)
True

In the same way, other labelers, such as modules.argumentation.labelers.fqas_labeler.FourBoolLabeler, can be used:

>>> arg_engine_four_bool_output = arg_engine_four_bool.update(['wrong_product', 'counter_party_delivered'])
>>> arg_engine_four_bool_output.labels.literal_labeling[arg_system.language['fraud']].is_stable
True
>>> arg_engine_four_bool_output = arg_engine_four_bool.update(['counter_party_delivered'])
>>> arg_engine_four_bool_output.labels.literal_labeling[arg_system.language['fraud']].is_contested_stable
True