diff --git a/ext/js/language/zh/chinese.js b/ext/js/language/zh/chinese.js index 3da34403b0..ca89de1ec9 100644 --- a/ext/js/language/zh/chinese.js +++ b/ext/js/language/zh/chinese.js @@ -71,5 +71,5 @@ export function isCodePointChinese(codePoint) { /** @type {import('language').ReadingNormalizer} */ export function normalizePinyin(str) { - return str.normalize('NFC').toLowerCase().replace(/(?<=\w)'(?=\w)/g, "\\'"); + return str.normalize('NFC').toLowerCase().replace(/[\s・:'’-]|\/\//g, ''); } diff --git a/test/language/chinese-reading-normalizer.test.js b/test/language/chinese-reading-normalizer.test.js index 166d1746a3..97d4fca27b 100644 --- a/test/language/chinese-reading-normalizer.test.js +++ b/test/language/chinese-reading-normalizer.test.js @@ -26,7 +26,7 @@ const tests = [ ['fān・yì', 'fānyì'], ['fān//yì', 'fānyì'], ['fān’yì', 'fānyì'], - ['fān'yì', 'fānyì'], + ['fān\'yì', 'fānyì'], ['fān-yì', 'fānyì'], ];