Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (28 sloc) 1.07 KB
"""
Samples for converting between Hankaku and Zenkaku (Japanese Chars).
Requirements:
- https://github.com/studio-ousia/mojimoji
"""
import mojimoji
#
# Zenkaku to Hankaku
#
print(mojimoji.zen_to_han("アイウエオ12345ABC"))
# => アイウエオ12345ABC
print(mojimoji.zen_to_han("アイウエオ12345ABC", kana=False))
# => アイウエオ12345ABC
print(mojimoji.zen_to_han("アイウエオ12345ABC", digit=False))
# => アイウエオ12345ABC
print(mojimoji.zen_to_han("アイウエオ12345ABC", ascii=False))
# => アイウエオ12345ABC
#
# Hankaku to Zenkaku
#
print(mojimoji.han_to_zen("アイウエオ12345abc"))
# => アイウエオ12345abc
print(mojimoji.han_to_zen("アイウエオ12345abc", kana=False))
# => アイウエオ12345abc
print(mojimoji.han_to_zen("アイウエオ12345abc", digit=False))
# => アイウエオ12345abc
print(mojimoji.han_to_zen("アイウエオ12345abc", ascii=False))
# => アイウエオ12345abc