feat(vocabService, VocabPracticeDialog, VocabLessonView): enhance vocabulary handling and exposure tracking
All checks were successful
Deploy to production / deploy (push) Successful in 2m51s
All checks were successful
Deploy to production / deploy (push) Successful in 2m51s
- Updated vocabService to merge extracted vocabularies and improve handling of learning and reference pairs. - Introduced normalization and exposure tracking in VocabPracticeDialog to ensure diverse and underexposed vocabulary practice. - Enhanced VocabLessonView with methods to identify underexposed vocabularies and adjust selection logic for improved learning outcomes. - Implemented new constants for minimum exposure requirements to optimize vocabulary training sessions.
This commit is contained in:
@@ -321,17 +321,17 @@ export const LESSON_DIDACTICS = {
|
||||
{ target: 'Duha', gloss: 'zwei' },
|
||||
{ target: 'Tulo', gloss: 'drei' },
|
||||
{ target: 'Upat', gloss: 'vier' },
|
||||
{ target: 'Lima', gloss: 'fuenf' },
|
||||
{ target: 'Lima', gloss: 'fünf' },
|
||||
{ target: 'Unom', gloss: 'sechs' },
|
||||
{ target: 'Pito', gloss: 'sieben' },
|
||||
{ target: 'Walo', gloss: 'acht' },
|
||||
{ target: 'Siyam', gloss: 'neun' },
|
||||
{ target: 'Napulo', gloss: 'zehn' },
|
||||
{ target: 'Napulo ug usa', gloss: 'elf' },
|
||||
{ target: 'Napulo ug duha', gloss: 'zwoelf' },
|
||||
{ target: 'Napulo ug duha', gloss: 'zwölf' },
|
||||
{ target: 'Napulo ug tulo', gloss: 'dreizehn' },
|
||||
{ target: 'Napulo ug upat', gloss: 'vierzehn' },
|
||||
{ target: 'Napulo ug lima', gloss: 'fuenfzehn' },
|
||||
{ target: 'Napulo ug lima', gloss: 'fünfzehn' },
|
||||
{ target: 'Napulo ug unom', gloss: 'sechzehn' },
|
||||
{ target: 'Napulo ug pito', gloss: 'siebzehn' },
|
||||
{ target: 'Napulo ug walo', gloss: 'achtzehn' },
|
||||
|
||||
@@ -614,6 +614,14 @@ export default class VocabService {
|
||||
const practicalTasks = Array.isArray(lesson?.practicalTasks) ? lesson.practicalTasks : [];
|
||||
const corePatterns = Array.isArray(lesson?.corePatterns) ? lesson.corePatterns : [];
|
||||
|
||||
corePatterns.forEach((entry) => {
|
||||
const pattern = this._normalizeCorePatternEntry(entry);
|
||||
const reference = String(pattern?.target || '').trim();
|
||||
const learning = String(pattern?.gloss || '').trim();
|
||||
if (!learning || !reference || learning === reference) return;
|
||||
vocabMap.set(`${learning}-${reference}`, { learning, reference });
|
||||
});
|
||||
|
||||
speakingPrompts.forEach((prompt, index) => {
|
||||
const learning = String(prompt?.prompt || prompt?.title || '').trim();
|
||||
const refEntry = corePatterns[index] ?? corePatterns[0];
|
||||
@@ -1488,9 +1496,12 @@ export default class VocabService {
|
||||
const extractedFromExercises = this._extractTrainerVocabsFromExercises(
|
||||
(lesson.grammarExercises || []).map((exercise) => exercise.get({ plain: true }))
|
||||
);
|
||||
const vocabs = extractedFromExercises.length > 0
|
||||
? extractedFromExercises
|
||||
: this._extractTrainerVocabsFromLessonDidactics(lesson.get({ plain: true }));
|
||||
const fallbackVocabs = this._extractTrainerVocabsFromLessonDidactics(lesson.get({ plain: true }));
|
||||
const mergedVocabs = new Map();
|
||||
[...fallbackVocabs, ...extractedFromExercises].forEach((entry) => {
|
||||
if (!entry?.learning || !entry?.reference) return;
|
||||
mergedVocabs.set(`${entry.learning}-${entry.reference}`, entry);
|
||||
});
|
||||
|
||||
return {
|
||||
lesson: {
|
||||
@@ -1499,7 +1510,7 @@ export default class VocabService {
|
||||
courseId: lesson.courseId,
|
||||
courseTitle: lesson.course.title
|
||||
},
|
||||
vocabs
|
||||
vocabs: Array.from(mergedVocabs.values())
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user