frontend: treat trailing parenthetical notes as optional in vocab matching
Some checks failed
Deploy to production / deploy (push) Has been cancelled
Some checks failed
Deploy to production / deploy (push) Has been cancelled
This commit is contained in:
@@ -4154,7 +4154,7 @@ export default {
|
||||
return text;
|
||||
},
|
||||
normalizeVocab(s, options = {}) {
|
||||
const { ignoreTrailingParentheticalNotes = false } = options;
|
||||
const { ignoreTrailingParentheticalNotes = true } = options;
|
||||
const source = ignoreTrailingParentheticalNotes
|
||||
? this.stripTrailingParentheticalNotes(s)
|
||||
: s;
|
||||
@@ -4250,15 +4250,13 @@ export default {
|
||||
userAnswer = this.vocabTrainerAnswer;
|
||||
}
|
||||
|
||||
const useTypingNormalization = this.vocabTrainerMode === 'typing';
|
||||
const normalizedUser = this.normalizeVocab(userAnswer, {
|
||||
ignoreTrailingParentheticalNotes: useTypingNormalization
|
||||
});
|
||||
// Treat parenthetical notes as optional for answer matching.
|
||||
const normalizedUser = this.normalizeVocab(userAnswer);
|
||||
const rawAnswers = this.currentVocabQuestion.answers || [this.currentVocabQuestion.answer];
|
||||
// Expand alternatives like "A / B" into separate acceptable answers
|
||||
const expandedAnswers = rawAnswers.flatMap(a => this.expandAnswerVariants(a));
|
||||
const normalizedCorrectAnswers = expandedAnswers
|
||||
.map(answer => this.normalizeVocab(answer, { ignoreTrailingParentheticalNotes: useTypingNormalization }));
|
||||
.map(answer => this.normalizeVocab(answer));
|
||||
this.vocabTrainerLastCorrect = normalizedCorrectAnswers.includes(normalizedUser);
|
||||
|
||||
// Update Stats
|
||||
|
||||
Reference in New Issue
Block a user