berniey / hanziconv

Hanzi Converter for Traditional and Simplified Chinese
Other
180 stars 43 forks source link

檀 in Traditional Chinese does not get converted to 坛 #14

Open chewsihui95 opened 6 years ago

chewsihui95 commented 6 years ago

Below is what I see in the shell:

Python 3.5.4 (v3.5.4:3f56838, Aug 8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information.

from hanziconv import HanziConv HanziConv.toSimplified("把中檀元帅固定在神轿") '把中檀元帅固定在神轿'

檀 should become 坛. 中檀元帅 is the name of a Taoist deity, if it helps with troubleshooting.

Let me know if more information is needed.

loretoparisi commented 4 years ago

@chewsihui95 at the end of the charmap I have added

addon_traditional = ''.join(textwrap.dedent("""
檀
""").split())

addon_simplified = ''.join(textwrap.dedent("""
坛
""").split())

simplified_charmap = cuhk_simplified + extra_simplified + addon_simplified
traditional_charmap = cuhk_traditional + extra_traditional + addon_traditional

So now If I do

print(HanziConv.toSimplified("把中檀元帅固定在神轿"))
把中坛元帅固定在神轿

That seems to be correct. I have noticed that, according to Google Translate, the correct word is 把中壇元帥固定在神轎 (so, third char should be and not ). In that case it works fine with the character you suggested: https://translate.google.com/?rlz=1C5CHFA_enIT832IT832&um=1&ie=UTF-8&hl=en&client=tw-ob#view=home&op=translate&sl=zh-CN&tl=zh-CN&text=%E6%8A%8A%E4%B8%AD%E5%A3%87%E5%85%83%E5%B8%A5%E5%9B%BA%E5%AE%9A%E5%9C%A8%E7%A5%9E%E8%BD%8E

by the way if you do

print(HanziConv.toSimplified("把中檀元帅固定在神轿"))
print(HanziConv.toSimplified("把中壇元帥固定在神轎"))
# 把中坛元帅固定在神轿

here works ok with the same result of Google Translate :)

NOTE. I'm not Chinese native speaker, so I do not know why Google is suggesting instead of . In any case your add-on is correct!