# domain/ontology.py GLOBAL_ONTOLOGY = { "algebra": { "solve_linear_system": { "concepts": ["מערכת", "מערכת משוואות", "חיתוך ישרים", "השוואת ביטויים", "נעלמים", "נציב", "נחלץ", "משוואות", "משתנה", "ערך"], "tag": "השוואה" }, "isolate_variable": { "concepts": ["בידוד משתנה", "העברת אגפים", "נחלק במקדם", "נחסר", "נכנס איברים דומים", "נפשט", "איברים"], "tag": "בידוד משתנה" }, "substitute": { "concepts": ["הצבה", "נציב את הערך", "משוואה מקורית", "ערך ה-y", "ערך ה-x", "משתנה שני"], "tag": "הצבה" }, "general_algebra": { "concepts": ["משוואה", "נעלם", "פתרון", "הסבר", "חישוב", "שלב"], "tag": "אלגברה בסיסית" } }, "geometry": { # Geometry terms will go here later } } def get_allowed_concepts(category: str, rule_id: str) -> list[str]: """Fetch allowed concepts from ontology""" domain = GLOBAL_ONTOLOGY.get(category.lower(), {}) rule_data = domain.get(rule_id, domain.get("general_algebra", {"concepts": []})) return rule_data.get("concepts", []) def get_pedagogical_tag(category: str, rule_id: str) -> str: """Fetch pedagogical tag from ontology""" domain = GLOBAL_ONTOLOGY.get(category.lower(), {}) rule_data = domain.get(rule_id, domain.get("general_algebra", {"tag": "כללי"})) return rule_data.get("tag", "כללי")