diff --git a/app.js b/app.js index e693eae..0643293 100644 --- a/app.js +++ b/app.js @@ -801,10 +801,10 @@ const practiceModeLabels = { function normalizePracticeAnswer(text) { return String(text || "") .toLowerCase() - .replace(/[’‘]/g, "'") + .replace(/['’‘]/g, "") .replace(/[“”]/g, "\"") .replace(/[-–—]+/g, " ") - .replace(/[.,!?;:"()[\]{},。!?;:“”‘’、]/g, " ") + .replace(/[.,!?;:"()[\]{},。!?;:“”、]/g, " ") .replace(/\s+/g, " ") .trim(); } diff --git a/tests/practice-helpers.test.mjs b/tests/practice-helpers.test.mjs index 255c9eb..ed6f996 100644 --- a/tests/practice-helpers.test.mjs +++ b/tests/practice-helpers.test.mjs @@ -7,7 +7,7 @@ import { } from "../app.js"; assert.equal(normalizePracticeAnswer(" Hello, WORLD! "), "hello world"); -assert.equal(normalizePracticeAnswer("I’m ready."), "i'm ready"); +assert.equal(normalizePracticeAnswer("I’m ready."), "im ready"); assert.equal(normalizePracticeAnswer("Are you ok? Yes!"), "are you ok yes"); assert.equal(normalizePracticeAnswer("Listen--then write"), "listen then write"); @@ -32,6 +32,13 @@ assert.deepEqual(comparePracticeAnswer("Good technology should help!", "Good tec message: "完全匹配。", }); +assert.deepEqual(comparePracticeAnswer("dont stop", "Don’t stop."), { + status: "correct", + isCorrect: true, + reference: "Don’t stop.", + message: "完全匹配。", +}); + assert.deepEqual(comparePracticeAnswer("Good tools help.", "Good technology should help."), { status: "incorrect", isCorrect: false,