Skip to content

Commit

Permalink
Fixed simplified dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
andreihar committed Apr 30, 2024
1 parent d8640d9 commit 8ae135d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion taibun/taibun.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions tests/test_additional.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ def test_convert_simplified():

def test_to_traditional():
assert '漢字是台灣用來寫幾若種現代佮古代語文个書寫文字系統' == to_traditional('汉字是台湾用来写几若种现代佮古代语文个书写文字系统')

def test_to_simplified():
assert '汉字是台湾用来写几若种现代佮古代语文个书写文字系统' == to_simplified('漢字是臺灣用來寫幾若種現代佮古代語文个書寫文字系統')

Expand Down

0 comments on commit 8ae135d

Please sign in to comment.