mojimoji is a Cython-based Python library designed for fast conversion between Japanese half-width (hankaku) and full-width (zenkaku) characters. The current version is 0.0.13, and it receives updates for bug fixes and Python version compatibility, though major feature releases are infrequent.
pip install mojimojiVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import the `mojimoji` library and use its primary conversion functions, `zen_to_han` and `han_to_zen`, including an example of selective conversion using keyword arguments.
Use the `kana`, `digit`, and `ascii` keyword arguments to control the conversion scope: `mojimoji.zen_to_han(' text ', kana=False, digit=True)`.Ensure you are using the `studio-ousia/mojimoji` Python package for character conversion and not confusing it with other similarly named projects or concepts.
Upgrade to `mojimoji` version 0.0.13 or newer: `pip install --upgrade mojimoji`.
Install the library using pip: `pip install mojimoji`.
Use the `kana=False`, `digit=False`, or `ascii=False` arguments within `zen_to_han()` or `han_to_zen()` to prevent conversion for specific character types. For example, `mojimoji.zen_to_han('ABC123', ascii=False)` will keep 'ABC' as full-width while converting '123'.Ensure you have the necessary build tools installed. For Windows, install 'Build Tools for Visual Studio'. For Linux, install `build-essential` (e.g., `sudo apt-get install build-essential`). For macOS, install Xcode Command Line Tools (`xcode-select --install`).