Repository: isi-vista/adam

Issue:
Handle core vocabulary verb: Go
Go (~3000):  ~400 bare, ~1200 with highly spatial/motion PP (“in”, “to”, “on”) ~700 with ADVP (“home”, “down”), ~400 with VP (e.g, “go get it”, “go move NP”).

Go: V modified by location. 

Comments:

Patch:
diff --git a/adam/curriculum/phase1_curriculum.py b/adam/curriculum/phase1_curriculum.py
index 66fc795d..0a54f222 100644
--- a/adam/curriculum/phase1_curriculum.py
+++ b/adam/curriculum/phase1_curriculum.py
@@ -33,6 +33,7 @@ from adam.ontology.phase1_ontology import (
     FLY,
     GAILA_PHASE_1_ONTOLOGY,
     GIVE,
+    GO,
     GOAL,
     GROUND,
     HAS,
@@ -45,6 +46,8 @@ from adam.ontology.phase1_ontology import (
     JUMP_INITIAL_SUPPORTER_AUX,
     LEARNER,
     LIQUID,
+    MOVE,
+    MOVE_GOAL,
     PATIENT,
     PERSON,
     PERSON_CAN_HAVE,
@@ -53,32 +56,32 @@ from adam.ontology.phase1_ontology import (
     ROLL,
     ROLLABLE,
     ROLL_SURFACE_AUXILIARY,
+    SELF_MOVING,
     SIT,
     SIT_GOAL,
     SIT_THING_SAT_ON,
+    SPIN,
+    TAKE,
     THEME,
     TRANSFER_OF_POSSESSION,
+    _GO_GOAL,
     bigger_than,
+    contacts,
     inside,
     is_recognized_particular,
     on,
     strictly_above,
-    TAKE,
-    SELF_MOVING,
-    MOVE,
-    MOVE_GOAL,
-    contacts,
-    SPIN,
 )
 from adam.ontology.phase1_spatial_relations import (
     AWAY_FROM,
     EXTERIOR_BUT_IN_CONTACT,
+    GRAVITATIONAL_DOWN,
     GRAVITATIONAL_UP,
     INTERIOR,
+    PROXIMAL,
     Region,
     SpatialPath,
     TOWARD,
-    PROXIMAL,
 )
 from adam.perception.developmental_primitive_perception import (
     DevelopmentalPrimitivePerceptionFrame,
@@ -1046,6 +1049,77 @@ def _make_spin_curriculum():
     )
 
 
+def _make_go_curriculum():
+    goer = object_variable("goer", THING, required_properties=[ANIMATE])
+    goal_reference = object_variable("go-goal", THING, required_properties=[HOLLOW])
+
+    bare_go = Phase1SituationTemplate(
+        "bare-go",
+        salient_object_variables=[goer],
+        actions=[
+            Action(
+                GO,
+                argument_roles_to_fillers=[(AGENT, goer)],
+                auxiliary_variable_bindings=[
+                    (_GO_GOAL, Region(goal_reference, distance=PROXIMAL))
+                ],
+            )
+        ],
+    )
+
+    go_in = Phase1SituationTemplate(
+        "go-in",
+        salient_object_variables=[goer, goal_reference],
+        actions=[
+            Action(
+                GO,
+                argument_roles_to_fillers=[
+                    (AGENT, goer),
+                    (GOAL, Region(goal_reference, distance=INTERIOR)),
+                ],
+            )
+        ],
+        constraining_relations=[bigger_than(goal_reference, goer)],
+    )
+
+    go_under = Phase1SituationTemplate(
+        "go-under",
+        salient_object_variables=[goer, goal_reference],
+        actions=[
+            Action(
+                GO,
+                argument_roles_to_fillers=[
+                    (AGENT, goer),
+                    (
+                        GOAL,
+                        Region(
+                            goal_reference,
+                            distance=PROXIMAL,
+                            direction=GRAVITATIONAL_DOWN,
+                        ),
+                    ),
+                ],
+            )
+        ],
+        constraining_relations=[bigger_than(goal_reference, goer)],
+    )
+
+    return _phase1_instances(
+        "go",
+        chain(
+            *[
+                sampled(
+                    situation,
+                    max_to_sample=25,
+                    chooser=_CHOOSER,
+                    ontology=GAILA_PHASE_1_ONTOLOGY,
+                )
+                for situation in (bare_go, go_in, go_under)
+            ]
+        ),
+    )
+
+
 GAILA_PHASE_1_CURRICULUM = [
     EACH_OBJECT_BY_ITSELF_SUB_CURRICULUM,
     OBJECTS_WITH_COLORS_SUB_CURRICULUM,
@@ -1067,6 +1141,7 @@ GAILA_PHASE_1_CURRICULUM = [
     _make_take_curriculum(),
     _make_move_curriculum(),
     _make_spin_curriculum(),
+    _make_go_curriculum(),
 ]
 """
 One particular instantiation of the curriculum for GAILA Phase 1.
diff --git a/adam/language_specific/english/english_language_generator.py b/adam/language_specific/english/english_language_generator.py
index 43cae37f..c2dc6509 100644
--- a/adam/language_specific/english/english_language_generator.py
+++ b/adam/language_specific/english/english_language_generator.py
@@ -71,6 +71,7 @@ from adam.ontology.phase1_spatial_relations import (
     PROXIMAL,
     Region,
     TOWARD,
+    GRAVITATIONAL_DOWN,
 )
 from adam.random_utils import SequenceChooser
 from adam.relation import Relation
@@ -580,6 +581,8 @@ class SimpleRuleBasedEnglishLanguageGenerator(
                 # TODO: put constraints on the axis
             ):
                 return "on"
+            elif region.direction == GRAVITATIONAL_DOWN:
+                return "under"
             else:
                 raise RuntimeError(
                     f"Don't know how to translate {region} to a preposition yet"
diff --git a/adam/ontology/phase1_ontology.py b/adam/ontology/phase1_ontology.py
index 0f43ed27..92e4fe3f 100644
--- a/adam/ontology/phase1_ontology.py
+++ b/adam/ontology/phase1_ontology.py
@@ -1053,12 +1053,29 @@ _PUSH_ACTION_DESCRIPTION = ActionDescription(
 _GO_AGENT = SituationObject(THING, properties=[SELF_MOVING])
 _GO_GOAL = SituationObject(THING)
 
-_GO_ACTION_DESCRIPTION = ActionDescription(
-    frame=ActionDescriptionFrame({AGENT: _GO_AGENT, GOAL: _GO_GOAL}),
-    during=DuringAction(objects_to_paths=[(_GO_AGENT, SpatialPath(TO, _GO_GOAL))]),
-    postconditions=[Relation(IN_REGION, _GO_AGENT, _GO_GOAL)],
-    asserted_properties=[(_GO_AGENT, VOLITIONALLY_INVOLVED), (_GO_AGENT, MOVES)],
-)
+
+def _make_go_description() -> Iterable[Tuple[OntologyNode, ActionDescription]]:
+    # bare go
+    postconditions = [Relation(IN_REGION, _GO_AGENT, _GO_GOAL)]
+    during: DuringAction[SituationObject] = DuringAction(
+        objects_to_paths=[(_GO_AGENT, SpatialPath(TO, _GO_GOAL))]
+    )
+    asserted_properties = [(_GO_AGENT, VOLITIONALLY_INVOLVED), (_GO_AGENT, MOVES)]
+    yield GO, ActionDescription(
+        frame=ActionDescriptionFrame({AGENT: _GO_AGENT}),
+        during=during,
+        postconditions=postconditions,
+        asserted_properties=asserted_properties,
+    )
+
+    # goes to goal
+    yield GO, ActionDescription(
+        frame=ActionDescriptionFrame({AGENT: _GO_AGENT, GOAL: _GO_GOAL}),
+        during=during,
+        postconditions=postconditions,
+        asserted_properties=asserted_properties,
+    )
+
 
 _COME_AGENT = SituationObject(THING, properties=[ANIMATE])
 _COME_GOAL = SituationObject(THING)
@@ -1457,7 +1474,6 @@ _FLY_ACTION_DESCRIPTION = ActionDescription(
 _ACTIONS_TO_DESCRIPTIONS = [
     (PUT, _PUT_ACTION_DESCRIPTION),
     (PUSH, _PUSH_ACTION_DESCRIPTION),
-    (GO, _GO_ACTION_DESCRIPTION),
     (COME, _COME_ACTION_DESCRIPTION),
     (GIVE, _GIVE_ACTION_DESCRIPTION),
     (TAKE, _TAKE_ACTION_DESCRIPTION),
@@ -1473,6 +1489,7 @@ _ACTIONS_TO_DESCRIPTIONS.extend(_make_drink_description())
 _ACTIONS_TO_DESCRIPTIONS.extend(_make_sit_action_descriptions())
 _ACTIONS_TO_DESCRIPTIONS.extend(_make_move_descriptions())
 _ACTIONS_TO_DESCRIPTIONS.extend(_make_spin_descriptions())
+_ACTIONS_TO_DESCRIPTIONS.extend(_make_go_description())
 
 GAILA_PHASE_1_ONTOLOGY = Ontology(
     "gaila-phase-1",


Test patch:
diff --git a/tests/curriculum/phase1_curriculum_test.py b/tests/curriculum/phase1_curriculum_test.py
index 08ebf813..55a489ec 100644
--- a/tests/curriculum/phase1_curriculum_test.py
+++ b/tests/curriculum/phase1_curriculum_test.py
@@ -13,6 +13,7 @@ from adam.curriculum.phase1_curriculum import (
     _make_take_curriculum,
     _make_move_curriculum,
     _make_spin_curriculum,
+    _make_go_curriculum,
 )
 
 
@@ -75,3 +76,7 @@ def test_move():
 
 def test_spin():
     _test_curriculum(_make_spin_curriculum())
+
+
+def test_go():
+    _test_curriculum(_make_go_curriculum())