Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add quantification semantics #925

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
5 changes: 2 additions & 3 deletions adam/axis.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from attr import attrs, attrib, evolve
from attr.validators import instance_of

from adam.utilities import sign
from attr import attrib, attrs, evolve
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for all the import diff spam. I asked PyCharm to optimize imports without remembering that I don't think we do isort on this repository.

from attr.validators import instance_of


@attrs(frozen=True, slots=True, repr=False, eq=False)
Expand Down
11 changes: 5 additions & 6 deletions adam/curriculum/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@
Code to specify what is shown to `LanguageLearner`\ s and in what order.
"""
from abc import ABC, abstractmethod
from typing import Generic, Iterable, Optional, Tuple, List

from attr import attrib, attrs
from attr.validators import instance_of
from immutablecollections.converter_utils import _to_tuple
from typing import Generic, Iterable, Optional, Tuple

from adam.language import LinguisticDescriptionT
from adam.language.language_generator import LanguageGenerator
from adam.situation import SituationT
from adam.perception import (
PerceptionT,
PerceptualRepresentation,
PerceptualRepresentationGenerator,
)
from adam.random_utils import SequenceChooser
from adam.situation import SituationT
from attr import attrib, attrs
from attr.validators import instance_of
from immutablecollections.converter_utils import _to_tuple


class InstanceGroup(ABC, Generic[SituationT, LinguisticDescriptionT, PerceptionT]):
Expand Down
21 changes: 10 additions & 11 deletions adam/curriculum/attribute_constraining_action_curriculum.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
from itertools import chain
from typing import Optional, Sequence

from adam.language.language_generator import LanguageGenerator
from adam.situation.high_level_semantics_situation import HighLevelSemanticsSituation
from adam.language.dependency import LinearizedDependencyTree
from adam.ontology import IS_SPEAKER, IS_ADDRESSEE
from adam.curriculum.curriculum_utils import (
Phase1InstanceGroup,
standard_object,
phase1_instances,
PHASE1_CHOOSER_FACTORY,
Phase1InstanceGroup,
make_noise_objects,
phase1_instances,
standard_object,
)
from adam.curriculum.phase1_curriculum import make_eat_template
from adam.ontology import THING
from adam.language.dependency import LinearizedDependencyTree
from adam.language.language_generator import LanguageGenerator
from adam.ontology import IS_ADDRESSEE, IS_SPEAKER, THING
from adam.ontology.phase1_ontology import (
PERSON,
ANIMATE,
EDIBLE,
NONHUMAN_ANIMAL,
GAILA_PHASE_1_ONTOLOGY,
ANIMATE,
NONHUMAN_ANIMAL,
PERSON,
)
from adam.situation.high_level_semantics_situation import HighLevelSemanticsSituation
from adam.situation.templates.phase1_templates import sampled


Expand Down
20 changes: 10 additions & 10 deletions adam/curriculum/curriculum_utils.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
from typing import Iterable, Union, Optional
from adam.ontology import IS_SPEAKER, IS_ADDRESSEE
from immutablecollections import immutableset
from adam.language.language_generator import LanguageGenerator
from typing import Iterable, Optional, Union

from adam.curriculum import GeneratedFromSituationsInstanceGroup, InstanceGroup
from adam.language.dependency import LinearizedDependencyTree
from adam.curriculum import InstanceGroup, GeneratedFromSituationsInstanceGroup
from adam.language.language_generator import LanguageGenerator
from adam.language_specific.english.english_language_generator import (
GAILA_PHASE_1_LANGUAGE_GENERATOR,
GAILA_PHASE_2_LANGUAGE_GENERATOR,
)
from adam.ontology import OntologyNode
from adam.ontology import IS_ADDRESSEE, IS_SPEAKER, OntologyNode
from adam.ontology.phase1_ontology import (
GROUND,
INANIMATE_OBJECT,
IS_BODY_PART,
THING,
LIQUID,
LEARNER,
LIQUID,
THING,
)
from adam.perception.developmental_primitive_perception import (
DevelopmentalPrimitivePerceptionFrame,
Expand All @@ -27,10 +26,11 @@
from adam.random_utils import RandomChooser
from adam.situation.high_level_semantics_situation import HighLevelSemanticsSituation
from adam.situation.templates.phase1_templates import (
object_variable,
TemplatePropertyVariable,
TemplateObjectVariable,
TemplatePropertyVariable,
object_variable,
)
from immutablecollections import immutableset

GROUND_OBJECT_TEMPLATE = object_variable("ground", GROUND)
PHASE1_CHOOSER_FACTORY = lambda: RandomChooser.for_seed(0) # noqa: E731
Expand Down
91 changes: 46 additions & 45 deletions adam/curriculum/imprecise_descriptions_curriculum.py
Original file line number Diff line number Diff line change
@@ -1,81 +1,82 @@
from itertools import chain
from typing import Sequence, Optional
from immutablecollections import immutableset
from typing import Optional, Sequence

from more_itertools import flatten
from adam.language.language_generator import LanguageGenerator
from adam.language.dependency import LinearizedDependencyTree

from adam.curriculum.curriculum_utils import (
Phase1InstanceGroup,
PHASE1_CHOOSER_FACTORY,
phase1_instances,
standard_object,
Phase1InstanceGroup,
learner_template_factory,
make_noise_objects,
phase1_instances,
standard_object,
)
from adam.ontology import IS_SPEAKER, IS_ADDRESSEE
from adam.curriculum.phase1_curriculum import (
bare_fly,
bare_move_template,
fall_on_ground_template,
falling_template,
intransitive_roll,
make_jump_template,
make_pass_template,
make_push_templates,
make_take_template,
make_walk_run_template,
throw_on_ground_template,
throw_template,
throw_up_down_template,
throw_to_template,
bare_move_template,
throw_up_down_template,
transitive_move_template,
make_jump_template,
intransitive_roll,
transitive_roll_with_surface,
transitive_roll,
bare_fly,
fall_on_ground_template,
falling_template,
make_take_template,
make_push_templates,
make_walk_run_template,
transitive_roll_with_surface,
)
from adam.language.dependency import LinearizedDependencyTree
from adam.language.language_generator import LanguageGenerator
from adam.language_specific.english.english_language_generator import (
USE_ADVERBIAL_PATH_MODIFIER,
USE_VERTICAL_MODIFIERS,
)
from adam.ontology import THING
from adam.ontology import IS_ADDRESSEE, IS_SPEAKER, THING
from adam.ontology.phase1_ontology import (
GAILA_PHASE_1_ONTOLOGY,
AGENT,
ANIMATE,
INANIMATE,
AWAY_FROM,
BABY,
BIRD,
BOX,
FAST,
HARD_FORCE,
SOFT_FORCE,
SLOW,
SELF_MOVING,
CAN_JUMP,
ROLLABLE,
CAN_HAVE_THINGS_RESTING_ON_THEM,
BIRD,
bigger_than,
EAT,
AGENT,
PATIENT,
CAN_JUMP,
CHAIR,
COOKIE,
WATERMELON,
TOWARD,
AWAY_FROM,
MOM,
LEARNER,
DOG,
BABY,
DAD,
CHAIR,
DOG,
EAT,
FAST,
GAILA_PHASE_1_ONTOLOGY,
HARD_FORCE,
INANIMATE,
LEARNER,
MOM,
PATIENT,
ROLLABLE,
SELF_MOVING,
SLOW,
SOFT_FORCE,
SPIN,
TABLE,
THEME,
SPIN,
TOWARD,
WATERMELON,
bigger_than,
)
from adam.situation import Action, SituationObject
from adam.situation.high_level_semantics_situation import HighLevelSemanticsSituation
from adam.situation.templates.phase1_templates import (
sampled,
TemplateObjectVariable,
Phase1SituationTemplate,
TemplateObjectVariable,
sampled,
)
from immutablecollections import immutableset

BOOL_SET = immutableset([True, False])

Expand Down
27 changes: 13 additions & 14 deletions adam/curriculum/m6_curriculum.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,17 @@
"""
import random as r
from itertools import chain
from typing import Sequence, List, Optional
from typing import List, Optional, Sequence

from more_itertools import flatten

from adam.situation.high_level_semantics_situation import HighLevelSemanticsSituation
from adam.language.language_generator import LanguageGenerator
from adam.language.dependency import LinearizedDependencyTree

from adam.curriculum import ExplicitWithSituationInstanceGroup
from adam.curriculum.curriculum_utils import (
PHASE1_CHOOSER_FACTORY,
Phase1InstanceGroup,
make_noise_objects,
phase1_instances,
standard_object,
make_noise_objects,
)
from adam.curriculum.phase1_curriculum import (
_make_each_object_by_itself_curriculum,
Expand All @@ -37,8 +33,11 @@
_over_template,
_under_template,
)
from adam.language.dependency import LinearizedDependencyTree
from adam.language.language_generator import LanguageGenerator
from adam.ontology import IS_ADDRESSEE, IS_SPEAKER
from adam.ontology.phase1_ontology import (
BABY,
BALL,
BIRD,
BOOK,
Expand All @@ -47,26 +46,26 @@
CHAIR,
COOKIE,
CUP,
DAD,
DOG,
DOOR,
GAILA_PHASE_1_ONTOLOGY,
HAND,
HAT,
HEAD,
HOUSE,
JUICE,
LEARNER,
MILK,
MOM,
TABLE,
TRUCK,
DAD,
BABY,
WATER,
HAND,
DOG,
MILK,
HEAD,
JUICE,
DOOR,
)
from adam.perception.high_level_semantics_situation_to_developmental_primitive_perception import (
GAILA_M6_PERCEPTION_GENERATOR,
)
from adam.situation.high_level_semantics_situation import HighLevelSemanticsSituation
from adam.situation.templates.phase1_templates import sampled

M6_PREPOSITION_CURRICULUM_SMALL_OBJECTS = [BALL, CUP, BOX, HAT, BOOK, COOKIE, BIRD]
Expand Down
Loading