summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiclas Dobbertin <niclas.dobbertin@mailbox.org>2024-09-05 20:21:37 +0200
committerNiclas Dobbertin <niclas.dobbertin@mailbox.org>2024-09-05 20:21:37 +0200
commit42c84ec037e9dee5038fbd0e6da1369493c99370 (patch)
treeed00ece22c617c89ac6d3b3576f3ba995f46239c
parent4841d9a3f6a6aa8dd943e8f6fa23820c9a3011d5 (diff)
retrieval retry
-rw-r--r--modeling/prod_multi.py59
-rw-r--r--modeling/prod_numbers.py22
2 files changed, 77 insertions, 4 deletions
diff --git a/modeling/prod_multi.py b/modeling/prod_multi.py
index 811e418..d7cf073 100644
--- a/modeling/prod_multi.py
+++ b/modeling/prod_multi.py
@@ -115,6 +115,61 @@ def multiplication(Model):
arg1 ~1
arg2 ~0
arg1 ~1
+ arg1 =arg1
+ arg2 =arg2
+ ?retrieval>
+ state free
+ ==>
+ =g>
+ isa math_goal
+ +retrieval>
+ isa math_op
+ op mul
+ arg1 =arg1
+ arg2 =arg2
+ """,
+ )
+ prods.append(mul_start)
+
+ mul_start_success = Model.productionstring(
+ name="mul_start_success",
+ string="""
+ =g>
+ isa math_goal
+ op mul
+ arg1 =arg1
+ arg2 =arg2
+ =retrieval>
+ isa math_op
+ op mul
+ arg1 =arg1
+ arg2 =arg2
+ result =result
+ ==>
+ =g>
+ isa math_goal
+ op done
+ +imaginal>
+ isa math_op
+ op mul
+ arg1 =arg1
+ arg2 =arg2
+ result =result
+ ~retrieval>
+ """,
+ )
+
+
+ mul_step = Model.productionstring(
+ name="mul_step",
+ string="""
+ =g>
+ isa math_goal
+ op mul
+ arg1 ~0
+ arg1 ~1
+ arg2 ~0
+ arg1 ~1
arg1 =mul
arg2 =arg
ones2 =ones
@@ -122,7 +177,7 @@ def multiplication(Model):
hundreds2 =huns
mul_counter None
?retrieval>
- state free
+ state error
==>
=g>
isa math_goal
@@ -135,7 +190,7 @@ def multiplication(Model):
arg2 =arg
""",
)
- prods.append(mul_start)
+ prods.append(mul_step)
mul_step_success = Model.productionstring(
name="mul_step_success",
diff --git a/modeling/prod_numbers.py b/modeling/prod_numbers.py
index cbc87e7..3943403 100644
--- a/modeling/prod_numbers.py
+++ b/modeling/prod_numbers.py
@@ -79,7 +79,6 @@ def number(Model):
isa math_goal
op expand
arg2 =num
- ones1 ~None
ones2 None
expand_slot None
?retrieval>
@@ -132,7 +131,6 @@ def number(Model):
==>
=g>
isa math_goal
- op done
expand_slot None
ones2 =one
tens2 =ten
@@ -142,6 +140,26 @@ def number(Model):
)
prods.append(number_expand_arg2_done)
+ number_expand_done = Model.productionstring(
+ name="number_expand_done",
+ string="""
+ =g>
+ isa math_goal
+ op expand
+ expand_slot None
+ ones1 ~None
+ tens1 ~None
+ hundreds1 ~None
+ ones2 ~None
+ tens2 ~None
+ hundreds2 ~None
+ ==>
+ =g>
+ isa math_goal
+ op done
+ """
+ )
+
number_contract_result = Model.productionstring(
name="number_contract_result",
string="""