25
25
from .syntactical_comparison_utilities import patterns as syntactical_forms
26
26
from .syntactical_comparison_utilities import is_number as syntactical_is_number
27
27
from .syntactical_comparison_utilities import response_and_answer_on_same_form
28
+ from .syntactical_comparison_utilities import written_as_answer
28
29
from .syntactical_comparison_utilities import attach_form_criteria
29
30
30
31
from .criteria_graph_utilities import CriteriaGraph
@@ -321,7 +322,6 @@ def same_symbols(unused_input):
321
322
for form_label in syntactical_forms .keys ():
322
323
has_recognisable_form = has_recognisable_form or syntactical_forms [form_label ]["matcher" ](parameters_dict ["original_input" ]["answer" ])
323
324
if has_recognisable_form is True :
324
-
325
325
graph .attach (
326
326
label + "_TRUE" ,
327
327
label + "_SYNTACTICAL_EQUIVALENCE" ,
@@ -347,30 +347,59 @@ def same_symbols(unused_input):
347
347
feedback_string_generator = symbolic_feedback_generators ["SYNTACTICAL_EQUIVALENCE" ]("FALSE" )
348
348
)
349
349
graph .attach (label + "_SYNTACTICAL_EQUIVALENCE" + "_FALSE" , END .label )
350
-
351
350
graph .attach (
352
351
label + "_TRUE" ,
353
352
label + "_SAME_FORM" ,
354
353
summary = str (lhs )+ " is written in the same form as " + str (rhs ),
355
354
details = str (lhs )+ " is written in the same form as " + str (rhs )+ "." ,
356
355
evaluate = response_and_answer_on_same_form (label + "_SAME_FORM" , parameters_dict )
357
356
)
358
-
359
357
for form_label in syntactical_forms .keys ():
360
358
if syntactical_forms [form_label ]["matcher" ](parameters_dict ["original_input" ]["answer" ]) is True :
361
359
attach_form_criteria (graph , label + "_SAME_FORM" , criterion , parameters_dict , form_label )
362
-
363
360
graph .attach (
364
361
label + "_SAME_FORM" ,
365
362
label + "_SAME_FORM" + "_UNKNOWN" ,
366
363
summary = "Cannot determine if " + str (lhs )+ " and " + str (rhs )+ " are written on the same form" ,
367
364
details = "Cannot determine if " + str (lhs )+ " and " + str (rhs )+ " are written on the same form." ,
368
365
feedback_string_generator = symbolic_feedback_generators ["SAME_FORM" ]("UNKNOWN" ),
369
366
)
370
-
371
367
graph .attach (label + "_SAME_FORM" + "_UNKNOWN" , END .label )
372
-
373
368
graph .attach (label + "_FALSE" , label + "_SAME_FORM" )
369
+ else :
370
+ graph .attach (
371
+ label + "_TRUE" ,
372
+ label + "_WRITTEN_AS_ANSWER" ,
373
+ summary = str (lhs )+ " is written in the same form as " + str (rhs ),
374
+ details = str (lhs )+ " is written in the same form as " + str (rhs )+ "." ,
375
+ evaluate = written_as_answer (label + "_WRITTEN_AS_ANSWER" , parameters_dict )
376
+ )
377
+ graph .attach (
378
+ label + "_WRITTEN_AS_ANSWER" ,
379
+ label + "_WRITTEN_AS_ANSWER" + "_UNKNOWN" ,
380
+ summary = "Cannot determine if " + str (lhs )+ " and " + str (rhs )+ " are written on the same form" ,
381
+ details = "Cannot determine if " + str (lhs )+ " and " + str (rhs )+ " are written on the same form." ,
382
+ feedback_string_generator = symbolic_feedback_generators ["SAME_FORM" ]("UNKNOWN" ),
383
+ )
384
+ graph .attach (label + "_WRITTEN_AS_ANSWER" + "_UNKNOWN" , END .label )
385
+ graph .attach (
386
+ label + "_WRITTEN_AS_ANSWER" ,
387
+ label + "_WRITTEN_AS_ANSWER" + "_TRUE" ,
388
+ summary = str (lhs )+ " is written in the same form as " + str (rhs ),
389
+ details = str (lhs )+ " is written in the same form as " + str (rhs )+ "." ,
390
+ feedback_string_generator = symbolic_feedback_generators ["SAME_FORM" ]("WRITTEN_AS_TRUE" ),
391
+ )
392
+ graph .attach (label + "_WRITTEN_AS_ANSWER" + "_TRUE" , END .label )
393
+ graph .attach (
394
+ label + "_WRITTEN_AS_ANSWER" ,
395
+ label + "_WRITTEN_AS_ANSWER" + "_FALSE" ,
396
+ summary = str (lhs )+ " is written in the same form as " + str (rhs ),
397
+ details = str (lhs )+ " is written in the same form as " + str (rhs )+ "." ,
398
+ feedback_string_generator = symbolic_feedback_generators ["SAME_FORM" ]("WRITTEN_AS_FALSE" ),
399
+ )
400
+ graph .attach (label + "_WRITTEN_AS_ANSWER" + "_FALSE" , END .label )
401
+
402
+ graph .attach (label + "_FALSE" , label + "_WRITTEN_AS_ANSWER" )
374
403
else :
375
404
graph .attach (label + "_FALSE" , END .label )
376
405
return graph
@@ -846,6 +875,9 @@ def symbolic_comparison(response, answer, params, eval_response) -> dict:
846
875
847
876
# TODO: Implement way to define completeness of task other than "all main criteria satisfied"
848
877
is_correct = is_correct and main_criteria in criteria_feedback
878
+ for tag in criteria_feedback :
879
+ if "WRITTEN_AS_ANSWER_FALSE" in tag :
880
+ is_correct = False
849
881
eval_response .add_criteria_graph (criterion_identifier , graph )
850
882
851
883
# Generate feedback strings from found feedback
0 commit comments