Build stage-one evidence extractor MVP
CI / test (push) Failing after 11m13s

This commit is contained in:
2026-10-01 22:16:29 +08:00
commit d30892168e
26 changed files with 2250 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
from __future__ import annotations
from dataclasses import asdict, dataclass
from typing import Any
COLORS = ("red", "blue", "green", "yellow")
SHAPES = ("circle", "square", "triangle", "star")
RELATIONS = ("left_of", "right_of", "above", "below")
CLASSES = ("alpha", "beta", "gamma", "delta")
OBJECT_IDS = ("obj1", "obj2", "obj3")
PREDICATES = ("color", "shape", "left_of", "right_of", "above", "below", "implies_class")
ENTITIES = OBJECT_IDS + COLORS + SHAPES + CLASSES
SUBJECT_TO_ID = {value: index for index, value in enumerate(ENTITIES)}
PREDICATE_TO_ID = {value: index for index, value in enumerate(PREDICATES)}
OBJECT_TO_ID = SUBJECT_TO_ID
@dataclass(frozen=True)
class Fact:
subject: str
predicate: str
object: str
def to_dict(self) -> dict[str, str]:
return asdict(self)
@classmethod
def from_dict(cls, value: dict[str, str]) -> "Fact":
return cls(**value)
@dataclass(frozen=True)
class SceneObject:
object_id: str
color: str
shape: str
x: int
y: int
def to_dict(self) -> dict[str, Any]:
return asdict(self)