Install mojimoji via pip
masterInstall the mojimoji package using pip to get access to fast Cython-based Japanese character conversion.
$ pip install mojimojirepository·master·Indexed 41 days ago
https://github.com/studio-ousia/mojimojiA high-performance Cython-based library for fast conversion between Japanese half-width (hankaku) and full-width (zenkaku) characters, featuring functions like mojimoji.zen_to_han and mojimoji.han_to_zen with configurable flags for kana, digits, and ASCII.
Install the mojimoji package using pip to get access to fast Cython-based Japanese character conversion.
$ pip install mojimojiUse mojimoji.han_to_zen(text, ...) to convert half-width (hankaku) characters to full-width (zenkaku) characters. You can control which character sets are converted using boolean flags:
kana: If False, katakana characters are not converted.digit: If False, numeric digits are not converted.ascii: If False, ASCII characters are not converted.import mojimoji
# Default conversion
print(mojimoji.han_to_zen('アイウabc012'))
# Output: アイウabc012
# Selective conversion
print(mojimoji.han_to_zen('アイウabc012', kana=False)) # Output: アイウabc012
print(mojimoji.han_to_zen('アイウabc012', digit=False)) # Output: アイウabc012
print(mojimoji.han_to_zen('アイウabc012', ascii=False)) # Output: アイウabc012Use mojimoji.zen_to_han(text, ...) to convert full-width (zenkaku) characters to half-width (hankaku) characters. You can control which character sets are converted using boolean flags:
kana: If False, katakana characters are not converted.digit: If False, numeric digits are not converted.ascii: If False, ASCII characters are not converted.import mojimoji
# Default conversion
print(mojimoji.zen_to_han('アイウabc012'))
# Output: アイウabc012
# Selective conversion
print(mojimoji.zen_to_han('アイウabc012', kana=False)) # Output: アイウabc012
print(mojimoji.zen_to_han('アイウabc012', digit=False)) # Output: アイウabc012
print(mojimoji.zen_to_han('アイウabc012', ascii=False)) # Output: アイウabc012