From 8ae135d4e510b3cbd9ce7667c7fc9ded67517a06 Mon Sep 17 00:00:00 2001 From: andreihar <95883512+andreihar@users.noreply.github.com> Date: Mon, 29 Apr 2024 18:28:39 -0700 Subject: [PATCH] Fixed simplified dictionary --- taibun/taibun.py | 2 +- tests/test_additional.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/taibun/taibun.py b/taibun/taibun.py index 24b6589..60770a5 100644 --- a/taibun/taibun.py +++ b/taibun/taibun.py @@ -5,7 +5,7 @@ word_dict = json.load(open(os.path.join(os.path.dirname(__file__), "data/words.json"),'r', encoding="utf-8")) trad_dict = json.load(open(os.path.join(os.path.dirname(__file__), "data/simplified.json"),'r', encoding="utf-8")) -simplified_dict = {v: k for k, v in trad_dict.items()}.update({'臺': '台'}) +simplified_dict = {**{v: k for k, v in trad_dict.items()}, '臺': '台'} # Helper to check if the character is a Chinese character def is_cjk(input): diff --git a/tests/test_additional.py b/tests/test_additional.py index d589870..2b06cec 100644 --- a/tests/test_additional.py +++ b/tests/test_additional.py @@ -6,6 +6,7 @@ def test_convert_simplified(): def test_to_traditional(): assert '漢字是台灣用來寫幾若種現代佮古代語文个書寫文字系統' == to_traditional('汉字是台湾用来写几若种现代佮古代语文个书写文字系统') + def test_to_simplified(): assert '汉字是台湾用来写几若种现代佮古代语文个书写文字系统' == to_simplified('漢字是臺灣用來寫幾若種現代佮古代語文个書寫文字系統')