habachen

raw JSON →
0.6.0 verified Mon Apr 27 auth: no python

Yet Another Fast Japanese String Converter. A Python library for converting between hiragana, katakana, and half-width katakana, with support for free-threading mode. Current version: 0.6.0, supports Python >=3.8.

pip install habachen
error ValueError: The 'ignore' string contains characters that are not convertible to hankaku katakana: ...
cause Using hiragana_to_katakana with hankaku=True and ignore string containing characters like ゐ or ゟ that have no hankaku equivalent.
fix
Remove problematic characters from ignore string, or set hankaku=False.
error ModuleNotFoundError: No module named 'habachen'
cause habachen is not installed or not in the Python path.
fix
Run pip install habachen ensure it's installed for the correct Python interpreter.
gotcha The function `hiragana_to_katakana` with `hankaku=True` raises a `ValueError` if the `ignore` string contains characters that are not convertible to hankaku katakana (e.g., ゐ or ゟ). This is more strict than in prior versions.
fix Ensure the ignore string only contains characters that can be converted to hankaku katakana, or set hankaku=False.
deprecated No deprecations noted; free-threading support is opt-in via Python build flags.
breaking Version 0.5.0 introduced stricter error handling: previously, `hiragana_to_katakana` with hankaku=True and invalid ignore chars may have silently ignored them; now it raises ValueError.
fix Review code that uses hankaku=True with ignore parameter and remove characters that cannot be converted (e.g., ゐ, ゟ).

Basic usage: convert between hiragana, katakana, and half-width katakana.

from habachen import hiragana_to_katakana, katakana_to_hiragana, to_hankaku_katakana

result = hiragana_to_katakana('あいう')
print(result)  # アイウ

result = katakana_to_hiragana('カキク')
print(result)  # かきく

result = to_hankaku_katakana('カタカナ')
print(result)  # タタナ(?? check actual)
print(result)