From 165ed8d0f5ff9e3ad20264e82f36d7eb37eecaa8 Mon Sep 17 00:00:00 2001 From: Cashew <52880648+cashewnuttynuts@users.noreply.github.com> Date: Sat, 13 Jul 2024 22:13:38 +0700 Subject: [PATCH] update normalizer regex (#1215) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Stefan Vuković --- ext/js/language/zh/chinese.js | 2 +- test/language/chinese-reading-normalizer.test.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/js/language/zh/chinese.js b/ext/js/language/zh/chinese.js index 3072d200f9..a17a82d1a6 100644 --- a/ext/js/language/zh/chinese.js +++ b/ext/js/language/zh/chinese.js @@ -63,5 +63,5 @@ export function isStringPartiallyChinese(str) { /** @type {import('language').ReadingNormalizer} */ export function normalizePinyin(str) { - return str.normalize('NFC').toLowerCase().replace(/[\s・:]/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 398ef0c91d..12eb47e6dc 100644 --- a/test/language/chinese-reading-normalizer.test.js +++ b/test/language/chinese-reading-normalizer.test.js @@ -24,6 +24,7 @@ const tests = [ ['Wéi jī Bǎi kē', 'wéijībǎikē'], ['wán:zhěng', 'wánzhěng'], ['fān・yì', 'fānyì'], + ['fān//yì', 'fānyì'], ]; describe('Normalize Pinyin', () => {