feat(exercises): enhance context in gap fill exercises and update migration for route descriptions
All checks were successful
Deploy to production / deploy (push) Successful in 3m21s
All checks were successful
Deploy to production / deploy (push) Successful in 3m21s
This commit is contained in:
@@ -599,7 +599,8 @@ function buildGapExercise(lessonTitle, pattern) {
|
||||
|
||||
function buildContextGapExercise(lesson, didactics, pattern) {
|
||||
const speakingPrompt = Array.isArray(didactics.speakingPrompts) ? didactics.speakingPrompts[0] : null;
|
||||
const cue = normalizeText(speakingPrompt?.cue || '').toLowerCase();
|
||||
const scenarioCue = normalizeText(speakingPrompt?.cue || '');
|
||||
const cue = scenarioCue.toLowerCase();
|
||||
// A contextual prompt must test a pattern that actually occurs in its
|
||||
// scenario. Otherwise a cultural keyword such as "respeto" can be paired
|
||||
// with an invitation-declining situation.
|
||||
@@ -608,14 +609,21 @@ function buildContextGapExercise(lesson, didactics, pattern) {
|
||||
.find((candidate) => candidate && cue.includes(normalizeText(candidate).toLowerCase()));
|
||||
// Do not hide a complete sentence behind one blank. Learners need enough
|
||||
// visible context to know which word or short phrase belongs in the gap.
|
||||
const gapExercise = scenarioPattern
|
||||
? buildGapExercise(lesson.title, scenarioPattern)
|
||||
: buildGapExercise(lesson.title, pattern);
|
||||
const scenarioSteps = scenarioCue
|
||||
.split(/[.!?]+/)
|
||||
.map((step) => step.trim())
|
||||
.filter(Boolean);
|
||||
// A multi-step cue is already the concrete scenario. Do not reduce a
|
||||
// route such as "Diretso. Tuo. Wala. Duol ra." to a bare direction word.
|
||||
const gapTarget = scenarioSteps.length >= 2
|
||||
? scenarioCue
|
||||
: (scenarioPattern || pattern);
|
||||
const gapExercise = buildGapExercise(lesson.title, gapTarget);
|
||||
if (!gapExercise) return null;
|
||||
|
||||
return {
|
||||
...gapExercise,
|
||||
title: `${lesson.title}: Kernmuster ergänzen`,
|
||||
title: `${lesson.title}: Satz im Kontext ergänzen`,
|
||||
instruction: `Vervollständige die Formulierung passend zur Situation: ${getScenarioPrompt(lesson, didactics)}`
|
||||
};
|
||||
}
|
||||
@@ -634,7 +642,7 @@ function buildSentenceExercise(lessonTitle, pattern) {
|
||||
instruction: 'Ordne die Wörter zu einem korrekten Bisaya-Satz.',
|
||||
questionData: {
|
||||
type: 'sentence_building',
|
||||
question: `Baue das Kernmuster aus der Lektion "${lessonTitle}".`,
|
||||
question: 'Ordne diese Wörter zu einem vollständigen Bisaya-Satz.',
|
||||
tokens
|
||||
},
|
||||
answerData: {
|
||||
|
||||
Reference in New Issue
Block a user