feat: support desktop exams with strict answer text verification

This commit is contained in:
薇星幻海
2026-10-10 06:39:36 +08:00
parent 3969c233b3
commit 3d7a1ffed0
16 changed files with 1137 additions and 187 deletions
+6 -4
View File
@@ -10,9 +10,11 @@
let importQueue = Promise.resolve();
function normalize(value) {
return String(value == null ? '' : value).normalize('NFKC')
.replace(/[−﹣]/g, '-').replace(/\u00a0/g, ' ')
.replace(/[\s\u200b\uFEFF]+/g, ' ').trim().toLowerCase();
// Answer identity must retain case, unit spelling, superscripts and punctuation.
// Only presentation whitespace and invisible layout characters are cleaned.
return String(value == null ? '' : value)
.replace(/[\u200b-\u200d\u2060\uFEFF]/g, '')
.replace(/\s+/g, ' ').trim();
}
function normalizeType(value) {
@@ -109,7 +111,7 @@
}
function boolValue(value) {
const text = normalize(value);
const text = normalize(value).toLowerCase();
if (/^(正确|对|是|true|√|✓)$/.test(text)) return 'true';
if (/^(错误|错|否|false|×|✗)$/.test(text)) return 'false';
return '';