feat(vocab): refine vocabulary filtering to exclude invalid exercise pairs
This commit is contained in:
@@ -3663,7 +3663,13 @@ export default {
|
|||||||
_buildMixedPool() {
|
_buildMixedPool() {
|
||||||
if (!this.previousVocab || this.previousVocab.length === 0) return [];
|
if (!this.previousVocab || this.previousVocab.length === 0) return [];
|
||||||
const currentKeys = new Set(this.trainableLessonVocab.map(v => this.getVocabKey(v)));
|
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 filteredByKey = new Map(filtered.map((v) => [this.getVocabKey(v), v]));
|
||||||
|
|
||||||
const weakMap = new Map();
|
const weakMap = new Map();
|
||||||
|
|||||||
Reference in New Issue
Block a user