diff options
Diffstat (limited to 'modeling/prod_numbers.py')
-rw-r--r-- | modeling/prod_numbers.py | 134 |
1 files changed, 134 insertions, 0 deletions
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 |