feat(bisaya-course): enhance grammar focus and drills for lesson content
All checks were successful
Deploy to production / deploy (push) Successful in 2m57s
All checks were successful
Deploy to production / deploy (push) Successful in 2m57s
- Added functions to normalize and build grammar curriculum focus entries, improving the structure and clarity of grammar lessons. - Implemented logic to merge existing grammar focus with newly defined curriculum focus, ensuring comprehensive coverage of key grammar points. - Introduced new drills for practicing past and future tense constructions, enhancing student engagement and understanding of temporal aspects in Bisaya. - Updated the `createBisayaCourseContent` function to incorporate these enhancements, ensuring lessons are enriched with relevant grammar exercises.
This commit is contained in:
@@ -206,6 +206,117 @@ function mergeCorePatternsForLesson(didactics, exerciseDerived, minCount = 8) {
|
||||
return out;
|
||||
}
|
||||
|
||||
function normalizeGrammarFocusEntry(entry) {
|
||||
if (!entry || typeof entry !== 'object') return null;
|
||||
const title = normalizeText(entry.title || '');
|
||||
const text = normalizeText(entry.text || '');
|
||||
const example = normalizeText(entry.example || '');
|
||||
if (!title || !text) return null;
|
||||
return { title, text, ...(example ? { example } : {}) };
|
||||
}
|
||||
|
||||
function buildGrammarCurriculumFocus(lesson) {
|
||||
const lessonNumber = Number(lesson?.lessonNumber || 0);
|
||||
const title = normalizeText(lesson?.title || '').toLowerCase();
|
||||
const out = [];
|
||||
|
||||
if (lessonNumber >= 1 && lessonNumber <= 10) {
|
||||
out.push({
|
||||
title: 'Kernaussage + Ergänzung',
|
||||
text: 'Im Alltag funktionieren kurze Muster am besten: Aussage zuerst, dann Ort/Zeit/Detail.',
|
||||
example: 'Naa ko sa balay. / Moadto ko unya.'
|
||||
});
|
||||
}
|
||||
|
||||
if (lessonNumber >= 11 && lessonNumber <= 20) {
|
||||
out.push({
|
||||
title: 'Präsens, Vergangenheit, Zukunft',
|
||||
text: 'In diesem Kurs arbeitest du mit klaren Zeitmarkern: Gegenwart über Kontext oder nag-/ga-, Vergangenheit oft mit ni-, Zukunft mit mo-.',
|
||||
example: 'Nagkaon ko. / Ni-kaon ko. / Mo-kaon ko.'
|
||||
});
|
||||
}
|
||||
|
||||
if (title.includes('zeitformen')) {
|
||||
out.push(
|
||||
{
|
||||
title: 'Vergangenheit mit ni-',
|
||||
text: 'ni- markiert häufig abgeschlossene Handlungen in der Vergangenheit.',
|
||||
example: 'Ni-adto ko. (Ich bin gegangen.)'
|
||||
},
|
||||
{
|
||||
title: 'Zukunft/Absicht mit mo-',
|
||||
text: 'mo- markiert häufig Zukünftiges oder eine geplante Handlung.',
|
||||
example: 'Mo-adto ko. (Ich werde gehen.)'
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (lessonNumber >= 21) {
|
||||
out.push({
|
||||
title: 'Aspekt statt starrer Zeiten',
|
||||
text: 'Bisaya nutzt im Alltag oft Aspektmarker und Kontext statt fixer Tempusformen. Zeitwörter wie karon, ganiha, ugma helfen bei der Einordnung.',
|
||||
example: 'Niadto ko ganiha. / Moadto ko ugma.'
|
||||
});
|
||||
}
|
||||
|
||||
return out.map((entry) => normalizeGrammarFocusEntry(entry)).filter(Boolean);
|
||||
}
|
||||
|
||||
function mergeGrammarFocusForLesson(existingFocus, curriculumFocus) {
|
||||
const out = [];
|
||||
const seen = new Set();
|
||||
const pushUnique = (entry) => {
|
||||
const normalized = normalizeGrammarFocusEntry(entry);
|
||||
if (!normalized) return;
|
||||
const key = `${normalized.title.toLowerCase()}|${normalized.text.toLowerCase()}`;
|
||||
if (seen.has(key)) return;
|
||||
seen.add(key);
|
||||
out.push(normalized);
|
||||
};
|
||||
(Array.isArray(existingFocus) ? existingFocus : []).forEach(pushUnique);
|
||||
(Array.isArray(curriculumFocus) ? curriculumFocus : []).forEach(pushUnique);
|
||||
return out;
|
||||
}
|
||||
|
||||
function buildZeitformenDrills(lessonTitle) {
|
||||
return [
|
||||
{
|
||||
exerciseTypeName: 'transformation',
|
||||
title: `${lessonTitle}: Vergangenheit bilden`,
|
||||
instruction: 'Übersetze den Satz ins Bisaya.',
|
||||
questionData: {
|
||||
type: 'transformation',
|
||||
text: 'Ich bin zum Markt gegangen.',
|
||||
sourceLanguage: 'Deutsch',
|
||||
targetLanguage: 'Bisaya'
|
||||
},
|
||||
answerData: {
|
||||
type: 'transformation',
|
||||
correct: 'Ni-adto ko sa merkado.',
|
||||
alternatives: ['Niadto ko sa merkado.', 'Niadto ko sa merkado.']
|
||||
},
|
||||
explanation: 'Vergangenheit wird hier mit ni- markiert.'
|
||||
},
|
||||
{
|
||||
exerciseTypeName: 'transformation',
|
||||
title: `${lessonTitle}: Zukunft bilden`,
|
||||
instruction: 'Übersetze den Satz ins Bisaya.',
|
||||
questionData: {
|
||||
type: 'transformation',
|
||||
text: 'Ich werde morgen nach Hause gehen.',
|
||||
sourceLanguage: 'Deutsch',
|
||||
targetLanguage: 'Bisaya'
|
||||
},
|
||||
answerData: {
|
||||
type: 'transformation',
|
||||
correct: 'Mo-adto ko sa balay ugma.',
|
||||
alternatives: ['Moadto ko sa balay ugma.', 'Mo uli ko ugma.']
|
||||
},
|
||||
explanation: 'Zukünftiges wird hier mit mo- plus Zeitwort (ugma) markiert.'
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
function sanitizeGapFillHintText(lessonTitle, text, answers, glossLookup) {
|
||||
const source = String(text || '');
|
||||
const normalizedAnswers = Array.isArray(answers)
|
||||
@@ -613,6 +724,9 @@ function generateExercisesFromDidactics(lesson) {
|
||||
buildTaskSentenceExercise(lesson, didactics, patternB),
|
||||
buildSpeakingExercise(lesson.title, didactics, patternA)
|
||||
];
|
||||
if (String(lesson.title || '').toLowerCase().includes('zeitformen')) {
|
||||
generated.push(...buildZeitformenDrills(lesson.title));
|
||||
}
|
||||
} else if (lesson.lessonType === 'review' || lesson.didacticMode === 'intensive_review') {
|
||||
generated = [
|
||||
buildReviewChoiceExercise(lesson, didactics, patternA, lessonPool),
|
||||
@@ -4575,6 +4689,13 @@ async function createBisayaCourseContent() {
|
||||
|
||||
// Erstelle Übungen
|
||||
const lessonDidactics = getLessonDidactics(lesson);
|
||||
const mergedGrammarFocus = mergeGrammarFocusForLesson(
|
||||
lessonDidactics.grammarFocus,
|
||||
buildGrammarCurriculumFocus(lesson)
|
||||
);
|
||||
if (mergedGrammarFocus.length > 0) {
|
||||
await lesson.update({ grammarFocus: mergedGrammarFocus });
|
||||
}
|
||||
const derivedCorePatterns = deriveLessonCorePatternsFromExercises(exercises);
|
||||
const mergedCorePatterns = mergeCorePatternsForLesson(lessonDidactics, derivedCorePatterns, 8);
|
||||
if (mergedCorePatterns.length >= 8) {
|
||||
|
||||
Reference in New Issue
Block a user