feat(vocab): refine vocabulary filtering to exclude invalid exercise pairs

This commit is contained in:
Torsten Schulz (local)
2026-08-26 14:05:40 +02:00
parent de1d71ad0a
commit efdaf87464

View File

@@ -3663,7 +3663,13 @@ export default {
_buildMixedPool() {
if (!this.previousVocab || this.previousVocab.length === 0) return [];
const currentKeys = new Set(this.trainableLessonVocab.map(v => this.getVocabKey(v)));
const filtered = this.previousVocab.filter(v => !currentKeys.has(this.getVocabKey(v)));
// Older generated exercises can contain a single word paired with a full
// sentence (e.g. "Haus" → "Naa ko sa balay"). Such pairs are neither
// valid vocabulary cards nor valid review questions.
const filtered = this.previousVocab.filter((v) => (
this.isTrainableLessonVocabPair(v?.learning, v?.reference)
&& !currentKeys.has(this.getVocabKey(v))
));
const filteredByKey = new Map(filtered.map((v) => [this.getVocabKey(v), v]));
const weakMap = new Map();