Metadata-Version: 2.3
Name: romkan2
Version: 0.1.0
Summary: A Romaji/Kana conversion library
Keywords: japanese,romaji,kana
Author: Yasuhiro Yamaguchi, Mort Yao
Author-email: Yasuhiro Yamaguchi <me@altescy.jp>, Mort Yao <mort.yao@gmail.com>
License: BSD
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Education
Classifier: Topic :: Text Processing :: Linguistic
Maintainer: Yasuhiro Yamaguchi
Maintainer-email: Yasuhiro Yamaguchi <me@altescy.jp>
Requires-Python: >=3.9
Project-URL: Homepage, https://github.com/altescy/romkan2
Project-URL: Issues, https://github.com/altescy/romkan2/issues
Project-URL: Repository, https://github.com/altescy/romkan2
Description-Content-Type: text/markdown

# romkan2

**romkan2** is a modernized, actively maintained fork of [python-romkan](https://github.com/soimort/python-romkan), designed as a **drop-in replacement** for the original library.

This is a Romaji/Kana conversion library for Python, which is used to convert a Japanese Romaji (ローマ字) string to a Japanese Kana (仮名) string or vice versa.

## Why romkan2?

The original [python-romkan](https://github.com/soimort/python-romkan) by Mort Yao has not been actively maintained in recent years. This fork aims to:

- Support modern Python versions (3.9+)
- Modernize the codebase with type hints and improved code structure
- Use contemporary Python packaging standards (pyproject.toml)
- Maintain full backward compatibility as a drop-in replacement

## Heritage

This library is the Pythonic port of [Ruby/Romkan](http://0xcc.net/ruby-romkan/index.html.en), originally authored by Satoru Takabayashi and [ported](http://lilyx.net/python-romkan/) by Masato Hagiwara, then modernized by Mort Yao.

romkan2 handles both Katakana (片仮名) and Hiragana (平仮名) with the Hepburn (ヘボン式) romanization system, as well as the modern Kunrei-shiki (訓令式) romanization system.



## Installation

Install via pip:

```bash
pip install romkan2
```

Or install from source:

```bash
git clone https://github.com/altescy/romkan2.git
cd romkan2
pip install -e .


```

## Usage

```python
import romkan

# Convert Kana to Romaji
print(romkan.to_roma("にんじゃ"))
# => ninja

print(romkan.to_hepburn("にんじゃ"))
# => ninja

print(romkan.to_kunrei("にんじゃ"))
# => ninzya

# Convert Romaji to Kana
print(romkan.to_hiragana("ninja"))
# => にんじゃ

print(romkan.to_katakana("ninja"))
# => ニンジャ
```



## API Reference

### `to_katakana(string: str) -> str`

Convert a Romaji (ローマ字) to a Katakana (片仮名).

### `to_hiragana(string: str) -> str`

Convert a Romaji (ローマ字) to a Hiragana (平仮名).

### `to_kana(string: str) -> str`

Convert a Romaji (ローマ字) to a Katakana (片仮名). (same as `to_katakana`)

### `to_hepburn(string: str) -> str`

Convert a Kana (仮名) or a Kunrei-shiki Romaji (訓令式ローマ字) to a Hepburn Romaji (ヘボン式ローマ字).

### `to_kunrei(string: str) -> str`

Convert a Kana (仮名) or a Hepburn Romaji (ヘボン式ローマ字) to a Kunrei-shiki Romaji (訓令式ローマ字).

### `to_roma(string: str) -> str`

Convert a Kana (仮名) to a Hepburn Romaji (ヘボン式ローマ字).



## Migration from python-romkan

romkan2 is a drop-in replacement for python-romkan. Simply replace:

```python
# Old
import romkan

# New
import romkan2 as romkan
```

The package name is different (`romkan2`), but the module name remains `romkan` for full backward compatibility.

## License

romkan2 is licensed under the [BSD license](LICENSE).

## Credits

- Original Ruby/Romkan: [Satoru Takabayashi](http://0xcc.net/ruby-romkan/index.html.en)
- Python port: [Masato Hagiwara](http://lilyx.net/python-romkan/)
- python-romkan: [Mort Yao](https://github.com/soimort/python-romkan)
- romkan2 (this fork): [Yasuhiro Yamaguchi](https://github.com/altescy)
