From 373867d5201d7583ffb42c15db77484f35e05ff0 Mon Sep 17 00:00:00 2001 From: Cristiano Ferreira Date: Sun, 24 Mar 2024 23:54:00 +0000 Subject: [PATCH] minor improvement to reading generation --- helper/constants.py | 9 +-------- helper/exercises.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/helper/constants.py b/helper/constants.py index 0ccaa0d..8c16c38 100644 --- a/helper/constants.py +++ b/helper/constants.py @@ -202,7 +202,6 @@ topics = [ "Renewable Energy Sources", "Cultural Heritage Preservation", "Modern Art Movements", - "Immigration Issues", "Sustainable Transportation", "The History of Medicine", "Artificial Neural Networks", @@ -225,7 +224,6 @@ topics = [ "Education Technology", "Renaissance Art", "Renewable Energy Policy", - "Cultural Festivals", "Modern Architecture", "Climate Resilience", "Artificial Life", @@ -248,11 +246,9 @@ topics = [ "Cultural Exchange", "Modern Sculpture", "Climate Mitigation", - "Artificial Intelligence Ethics", "Mindfulness", "Literary Criticism", "Wildlife Conservation", - "Political Activism", "Renewable Energy Innovations", "History of Mathematics", "Human-Computer Interaction", @@ -260,13 +256,11 @@ topics = [ "Cultural Appropriation", "Traditional cuisine and culinary arts", "Local music and dance traditions", - "Cultural festivals and celebrations", "History of the region and historical landmarks", "Traditional crafts and artisanal skills", "Wildlife and conservation efforts", "Local sports and athletic competitions", "Fashion trends and clothing styles", - "Literature and poetry from the region", "Education systems and advancements", "Healthcare services and medical innovations", "Family values and social dynamics", @@ -276,8 +270,7 @@ topics = [ "Entrepreneurship and business ventures", "Youth empowerment initiatives", "Art exhibitions and cultural events", - "Philanthropy and community development projects", - "Political developments and civic engagement efforts" + "Philanthropy and community development projects" ] two_people_scenarios = [ diff --git a/helper/exercises.py b/helper/exercises.py index 1e6f534..23dc378 100644 --- a/helper/exercises.py +++ b/helper/exercises.py @@ -23,6 +23,8 @@ def gen_reading_passage_1(topic, req_exercises, difficulty): number_of_exercises_q = divide_number_into_parts(TOTAL_READING_PASSAGE_1_EXERCISES, len(req_exercises)) passage = generate_reading_passage(QuestionType.READING_PASSAGE_1, topic) + if passage == "": + return gen_reading_passage_1(topic, req_exercises, difficulty) start_id = 1 exercises = generate_reading_exercises(passage["text"], req_exercises, number_of_exercises_q, start_id, difficulty) if contains_empty_dict(exercises): @@ -44,10 +46,12 @@ def gen_reading_passage_2(topic, req_exercises, difficulty): number_of_exercises_q = divide_number_into_parts(TOTAL_READING_PASSAGE_2_EXERCISES, len(req_exercises)) passage = generate_reading_passage(QuestionType.READING_PASSAGE_2, topic) + if passage == "": + return gen_reading_passage_2(topic, req_exercises, difficulty) start_id = 14 exercises = generate_reading_exercises(passage["text"], req_exercises, number_of_exercises_q, start_id, difficulty) if contains_empty_dict(exercises): - return gen_reading_passage_1(topic, req_exercises, difficulty) + return gen_reading_passage_2(topic, req_exercises, difficulty) return { "exercises": exercises, "text": { @@ -65,10 +69,12 @@ def gen_reading_passage_3(topic, req_exercises, difficulty): number_of_exercises_q = divide_number_into_parts(TOTAL_READING_PASSAGE_3_EXERCISES, len(req_exercises)) passage = generate_reading_passage(QuestionType.READING_PASSAGE_3, topic) + if passage == "": + return gen_reading_passage_3(topic, req_exercises, difficulty) start_id = 27 exercises = generate_reading_exercises(passage["text"], req_exercises, number_of_exercises_q, start_id, difficulty) if contains_empty_dict(exercises): - return gen_reading_passage_1(topic, req_exercises, difficulty) + return gen_reading_passage_3(topic, req_exercises, difficulty) return { "exercises": exercises, "text": {