From 6cb9ee72ba1b2dffcbe418129a110c1d0bbcc0b3 Mon Sep 17 00:00:00 2001 From: "Dobbertin, Niclas" Date: Fri, 10 May 2024 09:08:22 +0200 Subject: progress --- modeling/prod_numbers.py | 134 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 modeling/prod_numbers.py (limited to 'modeling/prod_numbers.py') diff --git a/modeling/prod_numbers.py b/modeling/prod_numbers.py new file mode 100644 index 0000000..8bf1ebb --- /dev/null +++ b/modeling/prod_numbers.py @@ -0,0 +1,134 @@ +#!/usr/bin/env python3 + +def number(Model): + prods = [] + + number_expand_arg1 = Model.productionstring( + name="number_expand_arg1", + string=""" + =g> + isa math_goal + op expand + expand_slot arg1 + arg1 =num + ==> + +retrieval> + isa number + number =num + """ + ) + prods.append(number_expand_arg1) + + number_expand_arg1_done = Model.productionstring( + name="number_expand_arg1_done", + string=""" + =g> + isa math_goal + op expand + expand_slot arg1 + arg1 =num + =retrieval> + isa number + number =num + ones =one + tens =ten + hundreds =hun + ==> + =g> + isa math_goal + op done + ones1 =one + tens1 =ten + hundreds1 =hun + """ + ) + prods.append(number_expand_arg1_done) + + + number_expand_arg2 = Model.productionstring( + name="number_expand_arg2", + string=""" + =g> + isa math_goal + op expand + expand_slot 2arg + arg2 =num + ==> + +retrieval> + isa number + number =num + """ + ) + prods.append(number_expand_arg2) + + number_expand_arg2_done = Model.productionstring( + name="number_expand_arg2_done", + string=""" + =g> + isa math_goal + op expand + expand_slot arg2 + arg2 =num + =retrieval> + isa number + number =num + ones =one + tens =ten + hundreds =hun + ==> + =g> + isa math_goal + op done + ones2 =one + tens2 =ten + hundreds2 =hun + """ + ) + prods.append(number_expand_arg2_done) + + number_contract_result = Model.productionstring( + name="number_contract_result", + string=""" + =g> + isa math_goal + op contract + expand_slot result + ones_ans =ones + tens_ans =tens + hundreds_ans =huns + ==> + +retrieval> + isa number + ones =ones + tens =tens + hundreds =huns + """ + ) + prods.append(number_contract_result) + + number_contract_result_done = Model.productionstring( + name="number_contract_result_done", + string=""" + =g> + isa math_goal + op contract + expand_slot result + ones_ans =ones + tens_ans =tens + hundreds_ans =huns + =retrieval> + isa number + number =num + ones =ones + tens =tens + hundreds =huns + ==> + =g> + isa math_goal + op done + result =num + """ + ) + prods.append(number_contract_result_done) + + return prods -- cgit v1.2.3