Skip to content

Commit

Permalink
fix(core): 优化单选题选项ABCD冗余并没有去掉的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed May 8, 2023
1 parent 0ebc3f9 commit f88fd86
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/core/src/core/worker/question.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ export function defaultQuestionResolve<E>(
* 在多个题库给出的答案中,找出最相似的答案
*/
async single(infos, options, handler) {
const allAnswer = infos.map((res) => res.results.map((res) => splitAnswer(res.answer)).flat()).flat();
const optionStrings = options.map((o) => removeRedundant(o.innerText));
/** 配对选项的相似度 */
const ratings = answerSimilar(
infos.map((res) => res.results.map((res) => splitAnswer(res.answer)).flat()).flat(),
options.map((el) => el.innerText)
);
const ratings = answerSimilar(allAnswer, optionStrings);
/** 找出最相似的选项 */
let index = -1;
let max = 0;
Expand Down Expand Up @@ -53,7 +52,7 @@ export function defaultQuestionResolve<E>(
}
}

return { finish: false, ratings };
return { finish: false, allAnswer, options: optionStrings, ratings };
},
/**
* 多选题处理器
Expand Down

0 comments on commit f88fd86

Please sign in to comment.