Skip to content

Commit 1ff3362

Browse files
Merge pull request #202 from lambda-feedback/tr170-basic-generic-syntactical-comparison
Clarified feedback messages for syntactical comparison
2 parents 354fa3c + d9cde00 commit 1ff3362

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

app/feedback/symbolic_comparison.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@
7070
}[tag]
7171
feedback_generators["response=answer"] = lambda tag: lambda inputs: {
7272
"TRUE": None, #"The response is equal to the expected answer.",
73+
"TRUE_DETAILED": "The response matches the expected expression", #"The response is equal to the expected answer.",
7374
"FALSE": None, #"The response is not equal to the expected answer.",
75+
"FALSE_DETAILED": "The response does not match the expected expression", #"The response is not equal to the expected answer.",
7476
"UNKNOWN": None, #"Cannot determine if answer is equal to response.",
7577
}[tag]
7678
feedback_generators["response=answer_where"] = lambda tag: lambda inputs: {

app/symbolic_comparison_evaluation.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,14 @@ def same_symbols(unused_input):
269269
else:
270270
return {label+"_SAME_SYMBOLS"+"_FALSE"}
271271

272+
273+
if parameters_dict.get("detailed_feedback", False) is True:
274+
math_eq_label_TRUE = "TRUE_DETAILED"
275+
math_eq_label_FALSE = "FALSE_DETAILED"
276+
else:
277+
math_eq_label_TRUE = "TRUE"
278+
math_eq_label_FALSE = "FALSE"
279+
272280
# Check for mathematical equivalence
273281
graph.add_evaluation_node(
274282
label,
@@ -281,7 +289,7 @@ def same_symbols(unused_input):
281289
label+"_TRUE",
282290
summary=str(lhs)+"="+str(rhs),
283291
details=str(lhs)+" is equal to "+str(rhs)+".",
284-
feedback_string_generator=symbolic_feedback_generators["response=answer"]("TRUE")
292+
feedback_string_generator=symbolic_feedback_generators["response=answer"](math_eq_label_TRUE)
285293
)
286294

287295
graph.attach(
@@ -313,7 +321,7 @@ def same_symbols(unused_input):
313321
label+"_FALSE",
314322
summary=str(lhs)+"=\\="+str(rhs),
315323
details=str(lhs)+" is not equal to"+str(rhs)+".",
316-
feedback_string_generator=symbolic_feedback_generators["response=answer"]("FALSE")
324+
feedback_string_generator=symbolic_feedback_generators["response=answer"](math_eq_label_FALSE)
317325
)
318326

319327
if parameters_dict["syntactical_comparison"] is True:

app/symbolic_comparison_evaluation_tests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,9 +1234,9 @@ def test_disabled_evaluation_nodes(self, response, answer, criteria, value, disa
12341234
("2*e**(2*I)", "2*e^(2*I)", "answer=response", True, ["answer=response_TRUE", "answer=response_SAME_SYMBOLS_TRUE", "answer=response_SYNTACTICAL_EQUIVALENCE_FALSE", "answer=response_SAME_FORM_EXPONENTIAL"], {}),
12351235
("e**(2*I)", "1*e^(2*I)", "answer=response", True, ["answer=response_TRUE", "answer=response_SAME_SYMBOLS_TRUE", "answer=response_SYNTACTICAL_EQUIVALENCE_FALSE", "answer=response_SAME_FORM_EXPONENTIAL"], {}),
12361236
("0.48+0.88*I", "1*e^(0.5*I)", "answer=response", False, ["answer=response_FALSE", "answer=response_SAME_FORM_UNKNOWN"], {}),
1237-
("(x-4)^2-5", "(x-4)^2-5", "answer=response", True, ["answer=response_TRUE", "answer=response_SAME_SYMBOLS_TRUE", "answer=response_WRITTEN_AS_ANSWER_TRUE"], {}),
1238-
("x^2-8x+11", "(x-4)^2-5", "answer=response", False, ["answer=response_TRUE", "answer=response_SAME_SYMBOLS_TRUE", "answer=response_WRITTEN_AS_ANSWER_FALSE"], {}),
1239-
("(x-3)^2-3", "(x-4)^2-5", "answer=response", False, ["answer=response_FALSE", "answer=response_WRITTEN_AS_ANSWER_TRUE"], {}),
1237+
("(x-4)^2-5", "(x-4)^2-5", "answer=response", True, ["answer=response_TRUE", "answer=response_SAME_SYMBOLS_TRUE", "answer=response_WRITTEN_AS_ANSWER_TRUE"], {"detailed_feedback": True}),
1238+
("x^2-8x+11", "(x-4)^2-5", "answer=response", False, ["answer=response_TRUE", "answer=response_SAME_SYMBOLS_TRUE", "answer=response_WRITTEN_AS_ANSWER_FALSE"], {"detailed_feedback": True}),
1239+
("(x-3)^2-3", "(x-4)^2-5", "answer=response", False, ["answer=response_FALSE", "answer=response_WRITTEN_AS_ANSWER_TRUE"], {"detailed_feedback": True}),
12401240
]
12411241
)
12421242
def test_syntactical_comparison(self, response, answer, criteria, value, feedback_tags, additional_params):

0 commit comments

Comments
 (0)