Added the start_id to the build_write_blanks_text_form

This commit is contained in:
Tiago Ribeiro
2024-02-05 12:19:33 +00:00
parent 678ef4b6c0
commit 3a1dc33e1b

View File

@@ -114,7 +114,7 @@ def build_write_blanks_text(questions: [], start_id):
def build_write_blanks_text_form(form: [], start_id):
result = ""
replaced_words = []
for i, entry in enumerate(form, start=1):
for i, entry in enumerate(form, start=start_id):
placeholder = '{{' + str(i) + '}}'
# Use regular expression to find the string after ':'
match = re.search(r'(?<=:)\s*(.*)', entry)
@@ -594,7 +594,7 @@ def gen_write_blanks_notes_exercise_listening_conversation(text: str, quantity:
replaced_notes = replace_first_occurrences_with_placeholders_notes(questions, words, start_id)
return {
"id": str(uuid.uuid4()),
"maxWords": 1,
"maxWords": 3,
"prompt": "Fill the blank space with the word missing from the audio.",
"solutions": build_write_blanks_solutions_listening(words, start_id),
"text": "\\n".join(replaced_notes),
@@ -619,7 +619,7 @@ def gen_write_blanks_notes_exercise_listening_monologue(text: str, quantity: int
replaced_notes = replace_first_occurrences_with_placeholders_notes(questions, words, start_id)
return {
"id": str(uuid.uuid4()),
"maxWords": 1,
"maxWords": 3,
"prompt": "Fill the blank space with the word missing from the audio.",
"solutions": build_write_blanks_solutions_listening(words, start_id),
"text": "\\n".join(replaced_notes),
@@ -642,7 +642,7 @@ def gen_write_blanks_form_exercise_listening_conversation(text: str, quantity: i
replaced_form, words = build_write_blanks_text_form(parsed_form, start_id)
return {
"id": str(uuid.uuid4()),
"maxWords": 1,
"maxWords": 3,
"prompt": "You will hear a conversation. Fill the form with words/numbers missing.",
"solutions": build_write_blanks_solutions_listening(words, start_id),
"text": replaced_form,
@@ -665,7 +665,7 @@ def gen_write_blanks_form_exercise_listening_monologue(text: str, quantity: int,
replaced_form, words = build_write_blanks_text_form(parsed_form, start_id)
return {
"id": str(uuid.uuid4()),
"maxWords": 1,
"maxWords": 3,
"prompt": "You will hear a monologue. Fill the form with words/numbers missing.",
"solutions": build_write_blanks_solutions_listening(words, start_id),
"text": replaced_form,