import random class PromptGenerator: def __init__(self): # 🧪 Clinical Dictionary: Categorized by diagnostic trigger self.lexicon = { "dyslexia_triggers": ["mysterious", "extraordinary", "peculiar", "fascinating", "cautious"], "dysgraphia_kinetic": ["vibrant", "twilight", "climb", "quickly", "jungle"], "dyscalculia_numerical": ["12", "7", "24", "105", "3"], "subjects": ["monkey", "traveler", "explorer", "creature"], "locations": ["valley", "peak", "forest", "canopy"], "actions": ["discovered", "watched", "followed", "noticed", "explored"] } def generate_balanced_session(self, level: str) -> dict: """ Assembles a prompt that satisfies Dyslexia, Dysgraphia, and Dyscalculia triggers in a single reading/writing flow. """ # 1. Select triggers and components d_word = random.choice(self.lexicon["dyslexia_triggers"]) k_word = random.choice(self.lexicon["dysgraphia_kinetic"]) num = random.choice(self.lexicon["dyscalculia_numerical"]) subject = random.choice(self.lexicon["subjects"]) location = random.choice(self.lexicon["locations"]) action = random.choice(self.lexicon["actions"]) # 2. Build Reading Task reading_text = ( f"The {num} {subject}s were very {d_word} today. " f"They lived in a {location} where the trees were {k_word}. " "Every morning, they would look for fruit near the river. " "It was a peaceful place, but the sounds of the jungle were loud. " "Soon, it was time for them to rest under the thick green leaves. " f"They felt safe in the {location} as the sun began to set." ) # 3. Build Writing Task writing_text = f"The {k_word} {d_word} {subject} {action} a hidden path. It was a very long journey." # ✅ FIX: Nesting triggers inside 'metadata' to satisfy main.py requirements return { "reading_task": reading_text, "writing_task": writing_text, "metadata": { "triggers": { "dyslexia": d_word, "dyscalculia": num, "dysgraphia": k_word }, "word_count": len(reading_text.split()) } } prompt_service = PromptGenerator()