Skip to content

Commit

Permalink
Fixed bug with dashes in literal names.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daphne Odekerken committed Apr 22, 2024
1 parent 28d7925 commit 1b02cf6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ def read_argumentation_theory(axioms_str: str, ordinary_premises_str: str,
# Derive the language: first obtain "absolute" literal strs from axioms and
# rules
def get_absolute(non_absolute_literal_str: str) -> str:
return non_absolute_literal_str.replace('~', '').replace('-', '')
while non_absolute_literal_str and non_absolute_literal_str[0] in '~-':
non_absolute_literal_str = non_absolute_literal_str[1:]
return non_absolute_literal_str

absolute_literal_strs = set()
for literal in axioms + ordinary_premises:
absolute_literal_strs.add(get_absolute(literal))
Expand All @@ -124,32 +127,38 @@ def get_absolute(non_absolute_literal_str: str) -> str:
language = {}
contraries_and_contradictories = {}
for literal_str in absolute_literal_strs:
l_pos = Literal(literal_str)
l_naf = Literal('~' + literal_str)
l_neg = Literal('-' + literal_str)
language[l_pos.s1] = l_pos
language[l_naf.s1] = l_naf
language[l_neg.s1] = l_neg

# Derive the contradiction function
contraries_and_contradictories[l_pos.s1] = {l_neg}
contraries_and_contradictories[l_naf.s1] = {l_pos}
contraries_and_contradictories[l_neg.s1] = {l_pos}
if literal_str != '':
l_pos = Literal(literal_str)
l_naf = Literal('~' + literal_str)
l_neg = Literal('-' + literal_str)
language[l_pos.s1] = l_pos
language[l_naf.s1] = l_naf
language[l_neg.s1] = l_neg

# Derive the contradiction function
contraries_and_contradictories[l_pos.s1] = {l_neg}
contraries_and_contradictories[l_naf.s1] = {l_pos}
contraries_and_contradictories[l_neg.s1] = {l_pos}

# Read axioms, ordinary premises, defeasible rules and strict rules, now in
# the proper format
axioms = [language[axiom_str] for axiom_str in axioms]
ordinary_premises = [language[ordinary_premise_str]
for ordinary_premise_str in ordinary_premises]
for ordinary_premise_str in ordinary_premises
if ordinary_premise_str != '']
defeasible_rules = \
[DefeasibleRule(rule_id, {language[antecedent]
for antecedent in antecedents},
for antecedent in antecedents
if antecedent != ''},
language[consequent])
for rule_id, antecedents, consequent in defeasible_rules]
for rule_id, antecedents, consequent in defeasible_rules
if consequent != '']
strict_rules = [StrictRule(rule_id, {language[antecedent]
for antecedent in antecedents},
for antecedent in antecedents
if antecedent != ''},
language[consequent])
for rule_id, antecedents, consequent in strict_rules]
for rule_id, antecedents, consequent in strict_rules
if consequent != '']

# Read the ordinary premise preferences
ordinary_premise_preference_strs = \
Expand Down
2 changes: 0 additions & 2 deletions src/py_arg_visualisation/pages/22_visualise_aspic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from dash import ctx, html, callback, Input, Output, State, ALL, dcc
from dash.exceptions import PreventUpdate

from py_arg.abstract_argumentation.import_export.argumentation_framework_from_json_reader import \
ArgumentationFrameworkFromJsonReader
from py_arg.aspic.classes.argumentation_system import ArgumentationSystem
from py_arg.aspic.classes.argumentation_theory import ArgumentationTheory
from py_arg.aspic.classes.instantiated_argument import InstantiatedArgument
Expand Down

0 comments on commit 1b02cf6

Please sign in to comment.