minor improvement to reading generation

This commit is contained in:
Cristiano Ferreira
2024-03-24 23:54:00 +00:00
parent 894cabdeb0
commit 373867d520
2 changed files with 9 additions and 10 deletions

View File

@@ -202,7 +202,6 @@ topics = [
"Renewable Energy Sources", "Renewable Energy Sources",
"Cultural Heritage Preservation", "Cultural Heritage Preservation",
"Modern Art Movements", "Modern Art Movements",
"Immigration Issues",
"Sustainable Transportation", "Sustainable Transportation",
"The History of Medicine", "The History of Medicine",
"Artificial Neural Networks", "Artificial Neural Networks",
@@ -225,7 +224,6 @@ topics = [
"Education Technology", "Education Technology",
"Renaissance Art", "Renaissance Art",
"Renewable Energy Policy", "Renewable Energy Policy",
"Cultural Festivals",
"Modern Architecture", "Modern Architecture",
"Climate Resilience", "Climate Resilience",
"Artificial Life", "Artificial Life",
@@ -248,11 +246,9 @@ topics = [
"Cultural Exchange", "Cultural Exchange",
"Modern Sculpture", "Modern Sculpture",
"Climate Mitigation", "Climate Mitigation",
"Artificial Intelligence Ethics",
"Mindfulness", "Mindfulness",
"Literary Criticism", "Literary Criticism",
"Wildlife Conservation", "Wildlife Conservation",
"Political Activism",
"Renewable Energy Innovations", "Renewable Energy Innovations",
"History of Mathematics", "History of Mathematics",
"Human-Computer Interaction", "Human-Computer Interaction",
@@ -260,13 +256,11 @@ topics = [
"Cultural Appropriation", "Cultural Appropriation",
"Traditional cuisine and culinary arts", "Traditional cuisine and culinary arts",
"Local music and dance traditions", "Local music and dance traditions",
"Cultural festivals and celebrations",
"History of the region and historical landmarks", "History of the region and historical landmarks",
"Traditional crafts and artisanal skills", "Traditional crafts and artisanal skills",
"Wildlife and conservation efforts", "Wildlife and conservation efforts",
"Local sports and athletic competitions", "Local sports and athletic competitions",
"Fashion trends and clothing styles", "Fashion trends and clothing styles",
"Literature and poetry from the region",
"Education systems and advancements", "Education systems and advancements",
"Healthcare services and medical innovations", "Healthcare services and medical innovations",
"Family values and social dynamics", "Family values and social dynamics",
@@ -276,8 +270,7 @@ topics = [
"Entrepreneurship and business ventures", "Entrepreneurship and business ventures",
"Youth empowerment initiatives", "Youth empowerment initiatives",
"Art exhibitions and cultural events", "Art exhibitions and cultural events",
"Philanthropy and community development projects", "Philanthropy and community development projects"
"Political developments and civic engagement efforts"
] ]
two_people_scenarios = [ two_people_scenarios = [

View File

@@ -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)) 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) passage = generate_reading_passage(QuestionType.READING_PASSAGE_1, topic)
if passage == "":
return gen_reading_passage_1(topic, req_exercises, difficulty)
start_id = 1 start_id = 1
exercises = generate_reading_exercises(passage["text"], req_exercises, number_of_exercises_q, start_id, difficulty) exercises = generate_reading_exercises(passage["text"], req_exercises, number_of_exercises_q, start_id, difficulty)
if contains_empty_dict(exercises): 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)) 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) passage = generate_reading_passage(QuestionType.READING_PASSAGE_2, topic)
if passage == "":
return gen_reading_passage_2(topic, req_exercises, difficulty)
start_id = 14 start_id = 14
exercises = generate_reading_exercises(passage["text"], req_exercises, number_of_exercises_q, start_id, difficulty) exercises = generate_reading_exercises(passage["text"], req_exercises, number_of_exercises_q, start_id, difficulty)
if contains_empty_dict(exercises): if contains_empty_dict(exercises):
return gen_reading_passage_1(topic, req_exercises, difficulty) return gen_reading_passage_2(topic, req_exercises, difficulty)
return { return {
"exercises": exercises, "exercises": exercises,
"text": { "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)) 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) passage = generate_reading_passage(QuestionType.READING_PASSAGE_3, topic)
if passage == "":
return gen_reading_passage_3(topic, req_exercises, difficulty)
start_id = 27 start_id = 27
exercises = generate_reading_exercises(passage["text"], req_exercises, number_of_exercises_q, start_id, difficulty) exercises = generate_reading_exercises(passage["text"], req_exercises, number_of_exercises_q, start_id, difficulty)
if contains_empty_dict(exercises): if contains_empty_dict(exercises):
return gen_reading_passage_1(topic, req_exercises, difficulty) return gen_reading_passage_3(topic, req_exercises, difficulty)
return { return {
"exercises": exercises, "exercises": exercises,
"text": { "text": {