feat(vocab): enrich core patterns with glosses in VocabService and VocabLessonView
All checks were successful
Deploy to production / deploy (push) Successful in 2m54s
All checks were successful
Deploy to production / deploy (push) Successful in 2m54s
- Implemented a new method in VocabService to enhance core patterns with glosses derived from extracted vocabulary, improving the clarity of vocabulary entries. - Updated the VocabLessonView to utilize the enriched core patterns, ensuring that glosses are displayed alongside vocabulary targets for better user comprehension. - Refactored vocabulary preparation logic to integrate glosses seamlessly, enhancing the overall user experience during vocabulary lessons.
This commit is contained in:
@@ -948,7 +948,18 @@ export default {
|
||||
},
|
||||
prepItems() {
|
||||
if (this.normalizedCorePatterns.length > 0) {
|
||||
return this.normalizedCorePatterns;
|
||||
const glossByReference = new Map(
|
||||
(this.importantVocab || [])
|
||||
.map((item) => [String(item?.reference || '').trim().toLowerCase(), String(item?.learning || '').trim()])
|
||||
.filter(([reference, learning]) => reference && learning)
|
||||
);
|
||||
return this.normalizedCorePatterns.map((item) => {
|
||||
if (item.gloss) {
|
||||
return item;
|
||||
}
|
||||
const gloss = glossByReference.get(String(item.target || '').trim().toLowerCase()) || '';
|
||||
return gloss ? { ...item, gloss } : item;
|
||||
});
|
||||
}
|
||||
return (this.importantVocab || [])
|
||||
.map((item) => ({
|
||||
|
||||
Reference in New Issue
Block a user