Spaces:
Running on Zero

readloops / exercises.py
ManasT2485's picture
Deploy original ReadLoops React interface with ZeroGPU speech bridge
3e6f84d verified
Raw History Blame Contribute Delete
2.62 kB
"""Versioned, authored alternatives for each practice passage."""
from content import BY_ID
EXTRAS = {
'en-practice-bookshop': {
'cloze': {'question': 'Complete the sentence: Anna sat beside the ___.', 'options': ['window', 'stairs', 'garden'], 'answer': 0, 'explanation': 'Anna sat beside the window.'},
'order': {'question': 'Which happened first?', 'options': ['Anna sat by the window', 'Anna walked to the bookshop', 'Anna picked a book'], 'answer': 1, 'explanation': 'Anna walked to the bookshop before choosing a book and sitting down.'},
},
'en-practice-market': {
'cloze': {'question': 'Complete the sentence: Sam brought a ___ bag.', 'options': ['paper', 'plastic', 'cloth'], 'answer': 2, 'explanation': 'Sam brought a cloth bag to the market.'},
'order': {'question': 'What happened after Sam bought the bread?', 'options': ['He met a neighbour', 'He left home for the market', 'He decided what to buy'], 'answer': 0, 'explanation': 'Sam met a neighbour on the way home.'},
},
'el-practice-bookshop': {
'cloze': {'question': 'Συμπλήρωσε: Η Άννα κάθισε δίπλα στο ___.', 'options': ['τραπέζι', 'παράθυρο', 'ράφι'], 'answer': 1, 'explanation': 'Η Άννα κάθισε δίπλα στο παράθυρο.'},
'order': {'question': 'Τι έκανε πρώτα η Άννα;', 'options': ['Κάθισε στο βιβλιοπωλείο', 'Διάλεξε ένα βιβλίο', 'Πήγε στο βιβλιοπωλείο'], 'answer': 2, 'explanation': 'Πρώτα πήγε στο βιβλιοπωλείο. Έπειτα διάλεξε ένα βιβλίο και κάθισε.'},
},
'el-practice-market': {
'cloze': {'question': 'Συμπλήρωσε: Ο Νίκος πήρε μια ___ τσάντα.', 'options': ['πάνινη', 'χάρτινη', 'πλαστική'], 'answer': 0, 'explanation': 'Ο Νίκος πήρε μια πάνινη τσάντα.'},
'order': {'question': 'Τι έκανε ο Νίκος μετά την αγορά;', 'options': ['Πήρε την τσάντα του', 'Συνάντησε μια γειτόνισσα', 'Αγόρασε μήλα'], 'answer': 1, 'explanation': 'Στον δρόμο για το σπίτι συνάντησε μια γειτόνισσα.'},
},
}
def exercise_for(passage_id, action):
exercise = BY_ID[passage_id]['exercise'] if action == 'comprehension' else EXTRAS[passage_id][action]
return {**exercise, 'action': action, 'version': 'authored-v1'}
def public_exercise(exercise):
return {key: value for key, value in exercise.items() if key not in ('answer', 'explanation')}