feat: support desktop exams with strict answer text verification
This commit is contained in:
+6
-4
@@ -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 '';
|
||||
|
||||
Reference in New Issue
Block a user