Skip to content

Commit 2c70b61

Browse files
committed
fix: fixed typos in param names
1 parent 5ad75cf commit 2c70b61

File tree

3 files changed

+22
-23
lines changed

3 files changed

+22
-23
lines changed

docs/dev.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ Select the sort of evlauation you want to using the check box. Make sure to only
1111
{
1212
"response": { "formula": "<str>", "truthTable": null | { "variables": ["<str>"], "cells": [[ "<str>" ]] } },
1313
"answer": {
14-
"satisability": true | false,
14+
"satisfiability": true | false,
1515
"tautology": true | false,
1616
"equivalent": null | "<str>",
17-
"truthTable": null | { }
17+
"validTruthTable": true | false
1818
},
1919
"params": { }
2020
}
2121
```
2222

23-
Exactly one of `satisability`, `tautology`, `equivalent` (non-null), or `truthTable` (non-null) must be set in `answer` to choose the evaluation mode.
23+
Exactly one of `satisfiability`, `tautology`, `equivalent` (non-null), or `validTruthTable` (true) must be set in `answer` to choose the evaluation mode.
2424

25-
### `truthTable`
25+
### `validTruthTable`
2626

27-
When `answer.truthTable` is not null, uses truth table evaluation (response must include `truthTable` with `variables` and `cells`).
27+
When `answer.validTruthTable` is true, uses truth table evaluation (response must include `truthTable` with `variables` and `cells`).
2828

2929
### `equivalent`
3030

@@ -34,9 +34,9 @@ When `answer.equivalent` is a string, checks if response formula and that formul
3434

3535
When `answer.tautology` is true, checks if response formula is a tautology.
3636

37-
### `satisability`
37+
### `satisfiability`
3838

39-
When `answer.satisability` is true, checks if response formula is satisfiable.
39+
When `answer.satisfiability` is true, checks if response formula is satisfiable.
4040

4141
## Outputs
4242

evaluation_function/evaluation.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,24 @@ def evaluation_function(
6666

6767
formula = formula_parser(response_formula)
6868

69-
# Answer shape: satisability (bool), tautology (bool), equivalent (None|str), truthTable (None|dict)
70-
satisability = answer.get("satisability", False) is True
69+
# Answer shape: satisfiability (bool), tautology (bool), equivalent (None|str), validTruthTable (bool)
70+
satisfiability = answer.get("satisfiability", answer.get("satisability", False)) is True
7171
tautology = answer.get("tautology", False) is True
7272
equivalent = answer.get("equivalent")
7373
if equivalent is not None and not isinstance(equivalent, str):
7474
equivalent = None
7575
elif equivalent is not None and isinstance(equivalent, str) and equivalent.strip() == "":
7676
equivalent = None
77-
answer_truth_table = answer.get("truthTable")
78-
77+
# validTruthTable (bool) or truthTable (None|dict) for backward compat
78+
has_truth_table = answer.get("validTruthTable", False) is True or answer.get("truthTable") is not None
7979
has_equivalence = equivalent is not None
80-
has_truth_table = answer_truth_table is not None
8180

82-
num_selected = sum([satisability, tautology, has_equivalence, has_truth_table])
81+
num_selected = sum([satisfiability, tautology, has_equivalence, has_truth_table])
8382

8483
if num_selected == 0:
8584
return Result(
8685
is_correct=False,
87-
feedback_items=[("invalid param", f"please select a param. got {answer}")]
86+
feedback_items=[("invalid param", "please select a param")]
8887
)
8988
if num_selected > 1:
9089
return Result(
@@ -120,7 +119,7 @@ def evaluation_function(
120119
is_correct = EquivalenceEvaluator(formula, answer_formula).evaluate()
121120
elif tautology:
122121
is_correct = TautologyEvaluator(formula).evaluate()
123-
elif satisability:
122+
elif satisfiability:
124123
is_correct = SatisfiabilityEvaluator(formula).evaluate()
125124
elif has_truth_table:
126125
is_correct = True # already validated above

evaluation_function/evaluation_test.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_check_tautology_fail(self):
5050

5151
def test_check_satisfiability(self):
5252
response = {"formula": "p ∧ q"}
53-
answer = {"satisability": True, "tautology": False, "equivalent": None, "truthTable": None}
53+
answer = {"satisfiability": True, "tautology": False, "equivalent": None, "validTruthTable": False}
5454
params = Params()
5555

5656
result = evaluation_function(response, answer, params).to_dict()
@@ -59,7 +59,7 @@ def test_check_satisfiability(self):
5959

6060
def test_check_satisfiability_fail(self):
6161
response = {"formula": "p ∧ ¬p"}
62-
answer = {"satisability": True, "tautology": False, "equivalent": None, "truthTable": None}
62+
answer = {"satisfiability": True, "tautology": False, "equivalent": None, "validTruthTable": False}
6363
params = Params()
6464

6565
result = evaluation_function(response, answer, params).to_dict()
@@ -68,7 +68,7 @@ def test_check_satisfiability_fail(self):
6868

6969
def test_check_equivalence(self):
7070
response = {"formula": "p ∧ q"}
71-
answer = {"satisability": False, "tautology": False, "equivalent": "p ∧ (q ∨ q)", "truthTable": None}
71+
answer = {"satisfiability": False, "tautology": False, "equivalent": "p ∧ (q ∨ q)", "validTruthTable": False}
7272
params = Params()
7373

7474
result = evaluation_function(response, answer, params).to_dict()
@@ -77,7 +77,7 @@ def test_check_equivalence(self):
7777

7878
def test_check_equivalence_fail(self):
7979
response = {"formula": "p ∧ q"}
80-
answer = {"satisability": False, "tautology": False, "equivalent": "p", "truthTable": None}
80+
answer = {"satisfiability": False, "tautology": False, "equivalent": "p", "validTruthTable": False}
8181
params = Params()
8282

8383
result = evaluation_function(response, answer, params).to_dict()
@@ -97,7 +97,7 @@ def test_truth_table_valid(self):
9797
]
9898
}
9999
}
100-
answer = {"satisability": False, "tautology": False, "equivalent": None, "truthTable": {}}
100+
answer = {"satisfiability": False, "tautology": False, "equivalent": None, "validTruthTable": True}
101101
params = Params()
102102

103103
result = evaluation_function(response, answer, params).to_dict()
@@ -117,7 +117,7 @@ def test_truth_table_invalid(self):
117117
]
118118
}
119119
}
120-
answer = {"satisability": False, "tautology": False, "equivalent": None, "truthTable": {}}
120+
answer = {"satisfiability": False, "tautology": False, "equivalent": None, "validTruthTable": True}
121121
params = Params()
122122

123123
result = evaluation_function(response, answer, params).to_dict()
@@ -145,7 +145,7 @@ def test_missing_formula_field(self):
145145

146146
def test_no_params_selected(self):
147147
response = {"formula": "p"}
148-
answer = {"satisability": False, "tautology": False, "equivalent": None, "truthTable": None}
148+
answer = {"satisfiability": False, "tautology": False, "equivalent": None, "validTruthTable": False}
149149
params = Params()
150150

151151
result = evaluation_function(response, answer, params).to_dict()
@@ -154,7 +154,7 @@ def test_no_params_selected(self):
154154

155155
def test_multiple_params_selected(self):
156156
response = {"formula": "p"}
157-
answer = {"satisability": True, "tautology": True, "equivalent": None, "truthTable": None}
157+
answer = {"satisfiability": True, "tautology": True, "equivalent": None, "validTruthTable": False}
158158
params = Params()
159159

160160
result = evaluation_function(response, answer, params).to_dict()

0 commit comments

Comments
 (0)