From 83966376d0a3ed107c75020f6e2adfa80fcfcb06 Mon Sep 17 00:00:00 2001 From: Matttttt <18152455+martholomew@users.noreply.github.com> Date: Tue, 28 May 2024 20:33:36 +0100 Subject: Removed normalizeTermOrReading (#985) * removed normalizeTermOrReading As it is not enabled, and enabling it would lead to unintended behavior for dictionaries, it makes sense to get rid of it. Signed-off-by: Matttttt <18152455+martholomew@users.noreply.github.com> * Re-added ternary operator Signed-off-by: Matttttt <18152455+martholomew@users.noreply.github.com> --------- Signed-off-by: Matttttt <18152455+martholomew@users.noreply.github.com> --- ext/js/dictionary/dictionary-importer.js | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/ext/js/dictionary/dictionary-importer.js b/ext/js/dictionary/dictionary-importer.js index f0c92481..98612d9e 100644 --- a/ext/js/dictionary/dictionary-importer.js +++ b/ext/js/dictionary/dictionary-importer.js @@ -615,8 +615,7 @@ export class DictionaryImporter { */ _convertTermBankEntryV1(entry, dictionary) { let [expression, reading, definitionTags, rules, score, ...glossary] = entry; - expression = this._normalizeTermOrReading(expression); - reading = this._normalizeTermOrReading(reading.length > 0 ? reading : expression); + reading = reading.length > 0 ? reading : expression; return {expression, reading, definitionTags, rules, score, glossary, dictionary}; } @@ -627,8 +626,7 @@ export class DictionaryImporter { */ _convertTermBankEntryV3(entry, dictionary) { let [expression, reading, definitionTags, rules, score, glossary, sequence, termTags] = entry; - expression = this._normalizeTermOrReading(expression); - reading = this._normalizeTermOrReading(reading.length > 0 ? reading : expression); + reading = reading.length > 0 ? reading : expression; return {expression, reading, definitionTags, rules, score, glossary, sequence, termTags, dictionary}; } @@ -783,20 +781,6 @@ export class DictionaryImporter { return counts; } - /** - * @param {string} text - * @returns {string} - */ - _normalizeTermOrReading(text) { - // Note: this function should not perform String.normalize on the text, - // as it will normalize characters in an undesirable way. - // Thus, this function is currently a no-op. - // Example: - // - '\u9038'.normalize('NFC') => '\u9038' (逸) - // - '\ufa67'.normalize('NFC') => '\u9038' (逸 => 逸) - return text; - } - /** * @template [T=unknown] * @param {import('@zip.js/zip.js').Entry} entry -- cgit v1.2.3