python-romkan
python-romkan 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.
It is the Pythonic port of Ruby/Romkan, originally authored by Satoru Takabayashi and ported by Masato Hagiwara.
python-romkan works on Python 2 and Python 3 (fully tested on Python 2.6, 2.7, 3.2, 3.3 and PyPy). It handles both Katakana (片仮名) and Hiragana (平仮名) with the Hepburn (ヘボン式) romanization system, as well as the modern Kunrei-shiki (訓令式) romanization system.
Project homepage: http://www.soimort.org/python-romkan
Fork me on GitHub: https://github.com/soimort/python-romkan
Installation
Install via Pip:
$ pip install romkan
Install via EasyInstall:
$ easy_install romkan
Install from Git:
$ git clone git://github.com/soimort/python-romkan.git $ python setup.py install
Usage
Python 3.x:
$ python
>>> import romkan
>>> print(romkan.to_roma("にんじゃ"))
ninja
>>> print(romkan.to_hepburn("にんじゃ"))
ninja
>>> print(romkan.to_kunrei("にんじゃ"))
ninzya
>>> print(romkan.to_hiragana("ninja"))
にんじゃ
>>> print(romkan.to_katakana("ninja"))
ニンジャ
Python 2.x:
$ python2
>>> import romkan
>>> print romkan.to_roma(u"にんじゃ")
ninja
>>> print romkan.to_hepburn(u"にんじゃ")
ninja
>>> print romkan.to_kunrei(u"にんじゃ")
ninzya
>>> print romkan.to_hiragana("ninja")
にんじゃ
>>> print romkan.to_katakana("ninja")
ニンジャ
API Reference
to_katakana(string)
Convert a Romaji (ローマ字) to a Katakana (片仮名).
to_hiragana(string)
Convert a Romaji (ローマ字) to a Hiragana (平仮名).
to_kana(string)
Convert a Romaji (ローマ字) to a Katakana (片仮名). (same as to_katakana)
to_hepburn(string)
Convert a Kana (仮名) or a Kunrei-shiki Romaji (訓令式ローマ字) to a Hepburn Romaji (ヘボン式ローマ字).
to_kunrei(string)
Convert a Kana (仮名) or a Hepburn Romaji (ヘボン式ローマ字) to a Kunrei-shiki Romaji (訓令式ローマ字).
to_roma(string)
Convert a Kana (仮名) to a Hepburn Romaji (ヘボン式ローマ字).
License
python-romkan is licensed under the BSD license.
Changelog
0.2.1
Date: 2013-02-26
Improved Python compatibility (2.6, <=3.1).
0.2.0
Date: 2013-02-21
Fixed the explicit unicode literal issue on Python 3.2.
Tested on Travis CI for Python 2.7, 3.2, 3.3 and PyPy.
0.1.0
Date: 2013-02-12
0.0.2
Date: 2013-01-29
Fixed #1.
0.0.1
Date: 2012-12-06
Initial release.
Metadata
Release files for romkan 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| romkan-0.2.1.tar.gz | 10.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| romkan-0.2.1-py3.3.egg | Legacy Egg format | - | - | Details |
Total release size: 25.9 kB
Release files / romkan-0.2.1.tar.gz
| Download URL | romkan-0.2.1.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a530245a38969704700e0ca8f9cb7158c4ede91c5fd1e24677dbe814cf91f33b
|
|
BLAKE2b-256 checksum How to use checksums |
13e65e2b4a6f37e10a9bbd686c315b0f329c3f0afae30f58be8c552ebaea0826
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / romkan-0.2.1-py3.3.egg
| Download URL | romkan-0.2.1-py3.3.egg |
|---|---|
| Size | 15.1 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
cc6f66c96973c04dd9bfedbe0e5e01170e4e8ecedd483d960f42aa94cb9cf144
|
|
BLAKE2b-256 checksum How to use checksums |
a04270e1bee15c68de714435dc2b9b87844bece08652885c2fadec8fed8fb25a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |